package com.migibert.kheo.resources;

import java.util.ArrayList;
import java.util.List;

import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;

import com.codahale.metrics.annotation.Timed;
import com.google.common.collect.Lists;
import com.migibert.kheo.core.NetworkInterface;
import com.migibert.kheo.core.Server;

@Path("servers")
@Produces(MediaType.APPLICATION_JSON)
public class ServerResource {

	@GET
	@Timed
	public List<Server> getServers() {
		return Lists.newArrayList(new Server("localhost", 4096, 2, new ArrayList<NetworkInterface>()));
	}
}

@@ -106,36 +106,142 @@
 .rs.
-GET;%0Aimport javax.ws.rs.Path
+DELETE;%0Aimport javax.ws.rs.GET;%0Aimport javax.ws.rs.POST;%0Aimport javax.ws.rs.PUT;%0Aimport javax.ws.rs.Path;%0Aimport javax.ws.rs.PathParam
 ;%0Aim
@@ -353,96 +353,8 @@
 ed;%0A
-import com.google.common.collect.Lists;%0Aimport com.migibert.kheo.core.NetworkInterface;%0A
 impo
@@ -472,16 +472,73 @@
 source %7B
+%0A%09%0A%09private List%3CServer%3E serverStore = new ArrayList%3C%3E();
 %0A%0A%09@GET%0A
@@ -594,98 +594,715 @@
 urn 
-Lists.newArrayList(new Server(%22localhost%22, 4096, 2, new ArrayList%3CNetworkInterface%3E()
+serverStore;%0A%09%7D%0A%09%0A%09@GET%0A%09@Timed%0A%09@Path(%22/%7Bhostname%7D%22)%0A%09public Server getServer(@PathParam(%22hostname%22) String hostname) %7B%0A%09%09for(Server server : serverStore) %7B%0A%09%09%09if(hostname.equals(server.getHostname())) %7B%0A%09%09%09%09return server;%0A%09%09%09%7D%0A%09%09%7D%0A%09%09return null;%0A%09%7D%0A%09%0A%09@POST%0A%09@Timed%0A%09public void createServer(Server server) %7B%0A%09%09serverStore.add(server);%0A%09%7D%0A%09%0A%09@PUT%0A%09@Timed%0A%09@Path(%22/%7Bhostname%7D%22)%0A%09public void updateServer(@PathParam(%22hostname%22) String hostname, Server server) %7B%0A%09%09serverStore.remove(getServer(hostname));%0A%09%09serverStore.add(server);%0A%09%7D%0A%09%0A%09@DELETE%0A%09@Timed%0A%09@Path(%22/%7Bhostname%7D%22)%0A%09public void deleteServer(@PathParam(%22hostname%22) String hostname, Server server) %7B%0A%09%09serverStore.remove(getServer(hostname
 ));%0A%09%7D%0A
+%09%0A%09%0A
 %7D%0A

Add basic CRUD support