/**
   * triggered when an admin client connects
   *
   * @param data
   * @param connection
   */
  public void onNewAdminClient(Client data, NetworkServiceClient connection) {
    // also trigger the normal client handling
    onNewClient(data, connection);

    ServerClient newAdminClient = new ServerClient(data, connection);
    synchronized (m_adminClients) {
      m_adminClients.put(data, newAdminClient);
    }

    // tell him about all the server configs + send him list of all clients
    List<ServerClient> all = null;
    synchronized (m_clients) {
      // copy the entries to be reistent to modifications while sending
      List<ServerClient> targets = m_clients.getAllClients();
      all = new ArrayList<ServerClient>(targets);
    }

    String msg = "";
    // tell him about all the clients that are connected
    for (ServerClient sc : all) {
      msg =
          AdminServerProtocolAbstractor.createClientMessage(
              sc.getClientInfo().m_id, sc.getClientInfo().m_address, true);
      sendToClient(newAdminClient, msg);
    }

    // tell him about all server configs:
    // TODO maybe add more configs!
    String pollTimeKey = Definitions.PREFIX_SERVER_DEFAULT_POLLING;
    String pollTimeValue = m_prefs.getValue(pollTimeKey);
    msg =
        AdminServerProtocolAbstractor.createConfigMessage(
            new Configuration(
                "default polling time: ", pollTimeKey, SettingType.number, pollTimeValue));
    sendToClient(newAdminClient, msg);

    // send all invisible sensors as sensor-config items
    // + send all polling sensors as polling frequency objects
    List<Sensor> allSensors = Server.getSensorStorage().getAllSensors();
    for (Sensor sensor : allSensors) {
      msg = createSensorVisiblityConf(sensor);
      sendToClient(newAdminClient, msg);
      if (sensor.isPolling) {
        msg = createSensorPollTimeConf(sensor);
        sendToClient(newAdminClient, msg);
      }
    }
  }
 /**
  * creates a config item for the sensors polling time
  *
  * @param sensor
  * @return
  */
 private String createSensorPollTimeConf(Sensor sensor) {
   String sensorsPollTimeKey = POLLTIME + sensor.ident;
   String value = m_prefs.getValue(sensorsPollTimeKey);
   Configuration config =
       new Configuration(
           "polling time of sensor " + sensor.description,
           sensorsPollTimeKey,
           SettingType.number,
           value);
   return AdminServerProtocolAbstractor.createSensorConfigMessage(sensor.ident, config);
 }
 /**
  * this creates a config item for the admin clients which allows them to toggle the visibility of
  * a sensor
  *
  * @param sensor the sensor
  */
 private String createSensorVisiblityConf(Sensor sensor) {
   String sensorsVisibilityKey = VISIBILITY + sensor.ident;
   String value = m_prefs.getValue(sensorsVisibilityKey);
   Configuration config =
       new Configuration(
           "visibility of sensor " + sensor.description,
           sensorsVisibilityKey,
           SettingType.bool,
           value);
   return AdminServerProtocolAbstractor.createSensorConfigMessage(sensor.ident, config);
 }
 @Override
 public void onClientRegistrationChanged(Client c, boolean registered) {
   List<Client> admins = null;
   // copy to avoid threading problems
   synchronized (m_adminClients) {
     admins = new ArrayList<Client>(m_adminClients.keySet());
   }
   String msg =
       AdminServerProtocolAbstractor.createClientMessage(c.m_id, c.m_address, registered);
   // send the client-change to every admin client
   for (Client admin : admins) {
     sendToClient(m_clients.getServerClientByClientInfo(admin), msg);
   }
 }