// Path: camelwatch-api/src/main/java/org/camelwatch/api/CamelBean.java
// public class CamelBean {
// 
// 	private final Map<String, Object>	properties	= Maps.newTreeMap();
// 
// 	private String				name;
// 
// 	private String				description;
// 
// 	public String getDescription() {
// 		return description;
// 	}
// 
// 	public String getName() {
// 		return name;
// 	}
// 
// 	public Map<String, Object> getProperties() {
// 		return properties;
// 	}
// 
// 	public void setDescription(String description) {
// 		this.description = description;
// 	}
// 
// 	public void setName(String name) {
// 		this.name = name;
// 	}
// 
// }
// 
// Path: camelwatch-api/src/main/java/org/camelwatch/api/CamelConnectionFactory.java
// @Service
// public class CamelConnectionFactory {
// 
//     @Value("${jmx.endpoint.url}")
//     private String url;
// 
//     @Value("${jmx.endpoint.username}")
//     private String username;
// 
//     @Value("${jmx.endpoint.password}")
//     private String password;
// 
//     private final Map<ObjectName, MBeanInfo> beanInfoCache = Maps.newHashMap();
// 
//     public CamelConnection getConnection() throws MalformedObjectNameException, NullPointerException, IOException {
//         return new CamelJmxConnection(url, username, password, beanInfoCache);
//     }
// 
//     public CamelConnection getConnection(String url, String username, String password) throws MalformedObjectNameException, NullPointerException, IOException {
//         Map<ObjectName, MBeanInfo> beanInfoCache = Maps.newHashMap() ;
//         return new CamelJmxConnection(url, username, password, beanInfoCache);
//     }
// }


import org.camelwatch.api.CamelBean;
import org.camelwatch.api.CamelConnectionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.List;

package camelwatch.rest;



/**
 * @author Stephen K Samuel samspade79@gmail.com 2 Jul 2012 10:09:57
 */
@Controller
public class RouteRestEndpoint {

    @Autowired
    private CamelConnectionFactory connectionFactory;

    @RequestMapping(value = "/rest/route", method = RequestMethod.GET)
    @ResponseBody
    public List<CamelBean> getConsumer() throws Exception {
        return connectionFactory.getConnection().getRoutes();
    }

    @RequestMapping(value = "/rest/route/{routeId}", method = RequestMethod.GET)
    @ResponseBody

// Path: camelwatch-api/src/main/java/org/camelwatch/api/CamelBean.java
// public class CamelBean {
// 
// 	private final Map<String, Object>	properties	= Maps.newTreeMap();
// 
// 	private String				name;
// 
// 	private String				description;
// 
// 	public String getDescription() {
// 		return description;
// 	}
// 
// 	public String getName() {
// 		return name;
// 	}
// 
// 	public Map<String, Object> getProperties() {
// 		return properties;
// 	}
// 
// 	public void setDescription(String description) {
// 		this.description = description;
// 	}
// 
// 	public void setName(String name) {
// 		this.name = name;
// 	}
// 
// }
// 
// Path: camelwatch-api/src/main/java/org/camelwatch/api/CamelConnectionFactory.java
// @Service
// public class CamelConnectionFactory {
// 
//     @Value("${jmx.endpoint.url}")
//     private String url;
// 
//     @Value("${jmx.endpoint.username}")
//     private String username;
// 
//     @Value("${jmx.endpoint.password}")
//     private String password;
// 
//     private final Map<ObjectName, MBeanInfo> beanInfoCache = Maps.newHashMap();
// 
//     public CamelConnection getConnection() throws MalformedObjectNameException, NullPointerException, IOException {
//         return new CamelJmxConnection(url, username, password, beanInfoCache);
//     }
// 
//     public CamelConnection getConnection(String url, String username, String password) throws MalformedObjectNameException, NullPointerException, IOException {
//         Map<ObjectName, MBeanInfo> beanInfoCache = Maps.newHashMap() ;
//         return new CamelJmxConnection(url, username, password, beanInfoCache);
//     }
// }


// Path: camelwatch-web/src/main/java/camelwatch/rest/RouteRestEndpoint.java
import org.camelwatch.api.CamelBean;
import org.camelwatch.api.CamelConnectionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.List;

package camelwatch.rest;



/**
 * @author Stephen K Samuel samspade79@gmail.com 2 Jul 2012 10:09:57
 */
@Controller
public class RouteRestEndpoint {

    @Autowired
    private CamelConnectionFactory connectionFactory;

    @RequestMapping(value = "/rest/route", method = RequestMethod.GET)
    @ResponseBody
    public List<CamelBean> getConsumer() throws Exception {
        return connectionFactory.getConnection().getRoutes();
    }

    @RequestMapping(value = "/rest/route/{routeId}", method = RequestMethod.GET)
    @ResponseBody

    public CamelBean getConsumer(@PathVariable("routeId") String routeId) throws Exception {
