code: public void generateConfig(File configFile, ContainerRoot model) throws IOException {
          StringBuilder buffer = new StringBuilder();
          buffer.append(OSHelper.read(this.getClass().getClassLoader().getResourceAsStream("base.cfg")));
          buffer.append("\n");
          HashMap<String, Backend> backends = new HashMap<String, Backend>();
          for (ContainerNode node : model.getNodes()) {
              for (ComponentInstance instance : node.getComponents()) {
                  if (instance.getTypeDefinition().getDictionaryType() != null
                          && instance.getTypeDefinition().getDictionaryType().findAttributesByID("http_port") != null
                          && instance.getStarted()
                          && !instance.getName().equals(context.getInstanceName())) {
  
                      if (!backends.containsKey(instance.getTypeDefinition().getName())) {
                          Backend backend = new Backend();
                          backends.put(instance.getTypeDefinition().getName(), backend);
                      }
                      Backend backend = backends.get(instance.getTypeDefinition().getName());
                      backend.setName(instance.getTypeDefinition().getName());
                      Server s = new Server();
                      s.setIp("127.0.0.1");
                      s.setName(instance.getName());
                      s.setPort(instance.getDictionary().findValuesByID("http_port").getValue());
                      backend.getServers().add(s);
                  }
              }
          }
  
          if (backends.size() > 0) {
              buffer.append("default_backend ");
              String firstKey = backends.keySet().iterator().next();
              buffer.append(backends.get(firstKey).getName());
              buffer.append("\n");
          }
          for (String key : backends.keySet()) {
              buffer.append("\n");
              buffer.append(backends.get(key));
              buffer.append("\n");
          }
          FileWriter writer = new FileWriter(configFile);
          writer.write(buffer.toString());
          writer.close();
      }
docs: TODO cleanup this ...