Search in sources :

Example 6 with WLMPortalException

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;
}
Also used : WLMPortalException(com.intel.mountwilson.common.WLMPortalException) JSONView(com.intel.mountwilson.util.JSONView) ModelAndView(org.springframework.web.servlet.ModelAndView) ArrayList(java.util.ArrayList) VmmHostDataVo(com.intel.mountwilson.datamodel.VmmHostDataVo) OSDataVO(com.intel.mountwilson.datamodel.OSDataVO)

Example 7 with WLMPortalException

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;
}
Also used : WLMPortalException(com.intel.mountwilson.common.WLMPortalException) JSONView(com.intel.mountwilson.util.JSONView) ModelAndView(org.springframework.web.servlet.ModelAndView) ArrayList(java.util.ArrayList) List(java.util.List) OSDataVO(com.intel.mountwilson.datamodel.OSDataVO)

Example 8 with WLMPortalException

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;
}
Also used : OemData(com.intel.mtwilson.datatypes.OemData) WLMPortalException(com.intel.mountwilson.common.WLMPortalException)

Example 9 with WLMPortalException

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;
}
Also used : OemData(com.intel.mtwilson.datatypes.OemData) WLMPortalException(com.intel.mountwilson.common.WLMPortalException)

Example 10 with WLMPortalException

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;
}
Also used : WLMPortalException(com.intel.mountwilson.common.WLMPortalException) JSONView(com.intel.mountwilson.util.JSONView) ModelAndView(org.springframework.web.servlet.ModelAndView) OEMDataVO(com.intel.mountwilson.datamodel.OEMDataVO)

Aggregations

WLMPortalException (com.intel.mountwilson.common.WLMPortalException)17 JSONView (com.intel.mountwilson.util.JSONView)11 ModelAndView (org.springframework.web.servlet.ModelAndView)11 ArrayList (java.util.ArrayList)7 List (java.util.List)6 OSDataVO (com.intel.mountwilson.datamodel.OSDataVO)4 MLEDataVO (com.intel.mountwilson.datamodel.MLEDataVO)3 FileUploadException (org.apache.commons.fileupload.FileUploadException)3 OEMDataVO (com.intel.mountwilson.datamodel.OEMDataVO)2 MLESearchCriteria (com.intel.mtwilson.datatypes.MLESearchCriteria)2 OemData (com.intel.mtwilson.datatypes.OemData)2 VmmHostDataVo (com.intel.mountwilson.datamodel.VmmHostDataVo)1 WhitelistService (com.intel.mtwilson.WhitelistService)1 MleData (com.intel.mtwilson.datatypes.MleData)1 HttpSession (javax.servlet.http.HttpSession)1