use of com.intel.mountwilson.common.WLMPortalException in project OpenAttestation by OpenAttestation.
the class WLMDataController method getHostOSForVMM.
public ModelAndView getHostOSForVMM(HttpServletRequest req, HttpServletResponse res) {
log.info("WLMDataController.getHostOSForVMM >>");
ModelAndView responseView = new ModelAndView(new JSONView());
List<VmmHostDataVo> list = new ArrayList<VmmHostDataVo>();
VmmHostDataVo dataVo = null;
List<String> VmmNames = getVMMNameList(WLMPConfig.getConfiguration().getString("mtwilson.wlmp.openSourceHypervisors"));
try {
List<OSDataVO> osList = osClientService.getAllOS(getWhitelistService(req));
for (OSDataVO osDataVO : osList) {
dataVo = new VmmHostDataVo();
dataVo.setHostOS(osDataVO.getOsName());
dataVo.setHostVersion(osDataVO.getOsVersion());
dataVo.setVmmNames(VmmNames);
dataVo.setAttestationType("PCR");
list.add(dataVo);
}
} catch (WLMPortalException e) {
log.error("Error While getting Host OS Data for VMM. Root cause " + e.getStackTrace());
responseView.addObject("result", false);
responseView.addObject("message", e.getMessage());
return responseView;
}
responseView.addObject("HostList", list);
responseView.addObject("result", true);
responseView.addObject("message", "");
log.info("WLMDataController.getHostOSForVMM <<<");
return responseView;
}
use of com.intel.mountwilson.common.WLMPortalException in project OpenAttestation by OpenAttestation.
the class WLMDataController method updateOSData.
/**
* Method to Update previously add OS Data into a REST Services.
*
*@param req (HttpServletRequest Object)
* @param res (HttpServletResponse Object)
* @return
*/
public ModelAndView updateOSData(HttpServletRequest req, HttpServletResponse res) {
log.info("WLMDataController.updateOSData >>");
ModelAndView responseView = new ModelAndView(new JSONView());
int selectedPage;
try {
//Get Current select page no used in pagination.
selectedPage = Integer.parseInt(req.getParameter("selectedPageNo"));
//Get updated OS data from req object and create OSDataVO Object from it.
OSDataVO dataVONew = new OSDataVO();
dataVONew.setOsName(req.getParameter("osName"));
dataVONew.setOsVersion(req.getParameter("osVer"));
dataVONew.setOsDescription(req.getParameter("inputDec"));
//Calling into Service Layer(OSClientServiceImpl) to update OS Data.
boolean updateDone = osClientService.updateOSInfo(dataVONew, getWhitelistService(req));
// Once OS data is updated, get List of all OS for a current page to show while pagination.
if (updateDone) {
//Get map view of OS data from Services based on there page no.
Map<Integer, List<OSDataVO>> mapOfData = getPartitionListOfAllOS(req);
responseView.addObject("OSDataVo", mapOfData.get(selectedPage));
responseView.addObject("noOfPages", mapOfData.size());
responseView.addObject("result", updateDone);
} else {
log.error("Error Wile Editing OS Data. Api Client return false.");
responseView.addObject("result", false);
responseView.addObject("message", "Error Wile Editing OS Data. Api Client return false.");
}
} catch (WLMPortalException e) {
log.error("Error Wile Editing OS Data. Root cause " + e.getMessage());
responseView.addObject("result", false);
responseView.addObject("message", e.getMessage());
}
log.info("WLMDataController.updateOSData <<<");
return responseView;
}
use of com.intel.mountwilson.common.WLMPortalException in project OpenAttestation by OpenAttestation.
the class OEMClientServiceImpl method addOEMInfo.
/**
* Method to add OEM Type into a Rest Services
*
* @param dataVO
* @param apiClientServices
* @return Boolean variable e.g true if OEM is added successfully
* @throws WLMPortalException
*/
@Override
public boolean addOEMInfo(OEMDataVO dataVO, WhitelistService apiClientServices) throws WLMPortalException {
log.info("OEMClientServiceImpl.addOEMInfo >>");
boolean result = false;
try {
apiClientServices.addOEM(new OemData(dataVO.getOemName(), dataVO.getOemDescription()));
result = true;
} catch (Exception e) {
log.error(e.getMessage());
throw ConnectionUtil.handleException(e);
}
log.info("OEMClientServiceImpl.addOEMInfo <<");
return result;
}
use of com.intel.mountwilson.common.WLMPortalException in project OpenAttestation by OpenAttestation.
the class OEMClientServiceImpl method updateOEMInfo.
/**
* Method to update OEM into a Rest Services
*
* @param dataVO
* @param apiClientServices
* @return Boolean variable e.g true if OEM is updated successfully
* @throws WLMPortalException
*/
@Override
public boolean updateOEMInfo(OEMDataVO dataVO, WhitelistService apiClientServices) throws WLMPortalException {
log.info("OEMClientServiceImpl.updateOEMInfo >>");
boolean result = false;
try {
apiClientServices.updateOEM(new OemData(dataVO.getOemName(), dataVO.getOemDescription()));
result = true;
} catch (Exception e) {
log.error(e.getMessage());
throw ConnectionUtil.handleException(e);
}
log.info("OEMClientServiceImpl.updateOEMInfo <<");
return result;
}
use of com.intel.mountwilson.common.WLMPortalException in project OpenAttestation by OpenAttestation.
the class WLMDataController method getHostOSForBios.
public ModelAndView getHostOSForBios(HttpServletRequest req, HttpServletResponse res) {
log.info("WLMDataController.getHostOSForBios >>");
ModelAndView responseView = new ModelAndView(new JSONView());
List<OEMDataVO> list = null;
try {
list = oemClientService.getAllOEM(getWhitelistService(req));
responseView.addObject("result", true);
} catch (WLMPortalException e) {
log.error("Error While getting Host OS Data for BIOS. Root cause " + e.getStackTrace());
responseView.addObject("result", false);
responseView.addObject("message", e.getMessage());
}
responseView.addObject("HostList", list);
responseView.addObject("message", "");
log.info("WLMDataController.getHostOSForBios <<<");
return responseView;
}
Aggregations