}
@Override
public Restlet createRoot()
{
Router router = new Router(getContext());
router.setDefaultMatchingMode(Template.MODE_EQUALS);
router.attach("/clusters", ClustersResource.class);
router.attach("/clusters/{clusterName}", ClusterResource.class);
router.attach("/clusters/{clusterName}/resourceGroups", ResourceGroupsResource.class);
router.attach("/clusters/{clusterName}/resourceGroups/{resourceName}", ResourceGroupResource.class);
router.attach("/clusters/{clusterName}/instances", InstancesResource.class);
router.attach("/clusters/{clusterName}/instances/{instanceName}", InstanceResource.class);
router.attach("/clusters/{clusterName}/instances/{instanceName}/currentState/{resourceName}", CurrentStateResource.class);
router.attach("/clusters/{clusterName}/instances/{instanceName}/statusUpdate/{resourceName}", StatusUpdateResource.class);
router.attach("/clusters/{clusterName}/instances/{instanceName}/errors/{resourceName}", ErrorResource.class);
router.attach("/clusters/{clusterName}/instances/{instanceName}/currentState", CurrentStatesResource.class);
router.attach("/clusters/{clusterName}/instances/{instanceName}/statusUpdate", StatusUpdatesResource.class);
router.attach("/clusters/{clusterName}/instances/{instanceName}/errors", ErrorsResource.class);
router.attach("/clusters/{clusterName}/resourceGroups/{resourceName}/idealState", IdealStateResource.class);
router.attach("/clusters/{clusterName}/resourceGroups/{resourceName}/externalView", ExternalViewResource.class);
router.attach("/clusters/{clusterName}/StateModelDefs/{modelName}", StateModelResource.class);
router.attach("/clusters/{clusterName}/StateModelDefs", StateModelsResource.class);
router.attach("/clusters/{clusterName}/SchedulerTasks", SchedulerTasksResource.class);
router.attach("/clusters/{clusterName}/Controller", ControllerResource.class);
router.attach("/clusters/{clusterName}/Controller/statusUpdates/{MessageType}/{MessageId}", ControllerStatusUpdateResource.class);
router.attach("/clusters/{clusterName}/configs", ConfigResource.class);
router.attach("/clusters/{clusterName}/configs/{scope}", ConfigResource.class);
router.attach("/clusters/{clusterName}/configs/{scope}/{scopeKey1}", ConfigResource.class);
router.attach("/clusters/{clusterName}/configs/{scope}/{scopeKey1}/{scopeKey2}", ConfigResource.class);
router.attach("/zkPath", ZkPathResource.class).setMatchingMode(Template.MODE_STARTS_WITH);
router.attach("/zkChild", ZkChildResource.class).setMatchingMode(Template.MODE_STARTS_WITH);
Restlet mainpage = new Restlet()
{
@Override
public void handle(Request request, Response response)
{
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append("<html>");
stringBuilder
.append("<head><title>Restlet Cluster Management page</title></head>");
stringBuilder.append("<body bgcolor=white>");
stringBuilder.append("<table border=\"0\">");
stringBuilder.append("<tr>");
stringBuilder.append("<td>");
stringBuilder.append("<h1>Rest cluster management interface V1</h1>");
stringBuilder.append("</td>");
stringBuilder.append("</tr>");
stringBuilder.append("</table>");
stringBuilder.append("</body>");
stringBuilder.append("</html>");
response.setEntity(new StringRepresentation(stringBuilder.toString(),
MediaType.TEXT_HTML));
}
};
router.attach("", mainpage);
return router;
}