ClusterServiceDAO clusterServiceDAO = injector.getInstance(ClusterServiceDAO.class);
ServiceComponentDesiredStateDAO serviceComponentDesiredStateDAO = injector.getInstance(ServiceComponentDesiredStateDAO.class);
List<ClusterEntity> clusterEntities = clusterDAO.findAll();
for (final ClusterEntity clusterEntity : clusterEntities) {
ServiceComponentDesiredStateEntityPK pkHS = new ServiceComponentDesiredStateEntityPK();
pkHS.setComponentName("HISTORYSERVER");
pkHS.setClusterId(clusterEntity.getClusterId());
pkHS.setServiceName("MAPREDUCE");
ServiceComponentDesiredStateEntity serviceComponentDesiredStateEntityHS = serviceComponentDesiredStateDAO.findByPK(pkHS);
// already have historyserver
if(serviceComponentDesiredStateEntityHS != null)
continue;
ServiceComponentDesiredStateEntityPK pkJT = new ServiceComponentDesiredStateEntityPK();
pkJT.setComponentName("JOBTRACKER");
pkJT.setClusterId(clusterEntity.getClusterId());
pkJT.setServiceName("MAPREDUCE");
ServiceComponentDesiredStateEntity serviceComponentDesiredStateEntityJT = serviceComponentDesiredStateDAO.findByPK(pkJT);
// no jobtracker present probably mapreduce is not installed
if(serviceComponentDesiredStateEntityJT == null)