Examples of ASException


Examples of com.intel.mountwilson.as.common.ASException

                                    }

                                } catch (ASException ase) {
                                        throw ase;
                                } catch (Exception e) {
                                    throw new ASException(e);
                                }
                                return mleDataList;
  }
View Full Code Here

Examples of com.intel.mountwilson.as.common.ASException

  public MleData findMle(String mleName, String mleVersion, String osName, String osVersion, String oemName) {
                                try {
                                        TblMle tblMle = getMleDetails(mleName, mleVersion, osName, osVersion, oemName);

                                        if (tblMle == null) {
                                            throw new ASException(ErrorCode.WS_MLE_DOES_NOT_EXIST, mleName, mleVersion);                       
                                        }

                                        MleData mleData = createMleDataFromDatabaseRecord(tblMle, true);
                                        return mleData;

                                } catch (ASException ase) {
                                        throw ase;
                                } catch (Exception e) {
                                    throw new ASException(e);
                                   
  }
View Full Code Here

Examples of com.intel.mountwilson.as.common.ASException

         * @return
         */
  private String validateNull(String label, String input) {
    if (input == null || input.isEmpty()) {
      log.info(String.format("Required input parameter '%s' is null or missing.", label));
      throw new ASException(ErrorCode.WS_MLE_DATA_MISSING, label);
    }
    return input;
  }
View Full Code Here

Examples of com.intel.mountwilson.as.common.ASException

  private TblOs getTblOs(String osName, String osVersion) {
    TblOs tblOs = new TblOsJpaController(getEntityManagerFactory())
        .findTblOsByNameVersion(osName, osVersion);

    if (tblOs == null)
      throw new ASException(ErrorCode.WS_OS_DOES_NOT_EXIST, osName, osVersion);

    return tblOs;
  }
View Full Code Here

Examples of com.intel.mountwilson.as.common.ASException

  private TblOem getTblOem(String oemName) {
    TblOem tblOem = new TblOemJpaController(getEntityManagerFactory())
        .findTblOemByName(oemName);

    if (tblOem == null)
      throw new ASException(ErrorCode.WS_OEM_DOES_NOT_EXIST, oemName);

    return tblOem;
  }
View Full Code Here

Examples of com.intel.mountwilson.as.common.ASException

         * @param oemName
         */
  private void validateMleExtraAttributes(String osName, String osVersion, String oemName) {
    if (StringUtils.isNotBlank(oemName)) {
      if ((StringUtils.isNotBlank(osName) || StringUtils.isNotBlank(osVersion)))
        throw new ASException(ErrorCode.WS_OEM_OS_DATA_CANNOT_COEXIST);
    } else if (StringUtils.isBlank(osName) || StringUtils.isBlank(osVersion)) {
      throw new ASException(ErrorCode.WS_MLE_DATA_MISSING, "OEM/OS");
    }

  }
View Full Code Here

Examples of com.intel.mountwilson.as.common.ASException

                                try {
                                  tblMle = getMleDetails(pcrData.getMleName(),
                                            pcrData.getMleVersion(), pcrData.getOsName(),
                                            pcrData.getOsVersion(), pcrData.getOemName());
                                  if (tblMle == null && pcrData.getOemName() != null) {
                                        throw new ASException(ErrorCode.WS_MLE_OEM_DOES_NOT_EXIST, pcrData.getMleName(), pcrData.getMleVersion(), pcrData.getOemName());
                                    }
                                    if (tblMle == null && pcrData.getOsName() != null) {
                                        throw new ASException(ErrorCode.WS_MLE_OS_DOES_NOT_EXIST, pcrData.getMleName(), pcrData.getMleVersion(), pcrData.getOsName(),pcrData.getOsVersion());
                                    }
                                   // Now we need to check if PCR is already configured. If yes, then
                                   // we ned to ask the user to use the Update option instead of create
                                   tblPcr = getPCRWhiteListDetails(tblMle.getId(), pcrData.getPcrName());
                                   if (tblPcr != null) {
                                        throw new ASException(ErrorCode.WS_PCR_WHITELIST_ALREADY_EXISTS, pcrData.getPcrName());
                                   }

           /*
                                   if (StringUtils.isNotBlank(pcrData.getOemName())) {
                                       log.info("BIOS MLE, check the range of PCR value " + pcrData.getPcrName());
                                       if (Integer.valueOf(pcrData.getPcrName()).intValue() > 5 || Integer.valueOf(pcrData.getPcrName()).intValue() < 0)
                                           throw new ASException(ErrorCode.WS_MLE_PCR_NOT_VALID, pcrData.getPcrName());
                                   } else {
                                       log.info("VMM MLE, check the range of PCR value " + pcrData.getPcrName());
                                       if (Integer.valueOf(pcrData.getPcrName()).intValue() > 20 || Integer.valueOf(pcrData.getPcrName()).intValue() < 17)
                                           throw new ASException(ErrorCode.WS_MLE_PCR_NOT_VALID, pcrData.getPcrName());
                                   } */
                                  
                                   // In order to reuse the addPCRManifest function, we need to create a list and
                                   // add a single entry into it using the manifest data that we got.
                                   List<ManifestData> pcrWhiteList = new ArrayList<ManifestData>();
                                   pcrWhiteList.add(new ManifestData(pcrData.getPcrName(), pcrData.getPcrDigest()));

                                   // Now add the pcr to the database.
                                   addPcrManifest(tblMle, pcrWhiteList);
                                } catch (ASException ase) {
                                    throw ase;
                                } catch (Exception e) {
                                    throw new ASException(e);
                                }
                                return "true";
  }
View Full Code Here

Examples of com.intel.mountwilson.as.common.ASException

                                try {
                                  tblMle = getMleDetails(pcrData.getMleName(),
                                            pcrData.getMleVersion(), pcrData.getOsName(),
                                            pcrData.getOsVersion(), pcrData.getOemName());
                                  if (tblMle == null && pcrData.getOemName() != null) {
                                        throw new ASException(ErrorCode.WS_MLE_OEM_DOES_NOT_EXIST, pcrData.getMleName(), pcrData.getMleVersion(), pcrData.getOemName());
                                    }
                                    if (tblMle == null && pcrData.getOsName() != null) {
                                        throw new ASException(ErrorCode.WS_MLE_OS_DOES_NOT_EXIST, pcrData.getMleName(), pcrData.getMleVersion(), pcrData.getOsName(),pcrData.getOsVersion());
                                    }

                                    // Now we need to check if PCR is already configured. If yes, then
                                    // we ned to ask the user to use the Update option instead of create
                                    tblPcr = getPCRWhiteListDetails(tblMle.getId(), pcrData.getPcrName());
                                    if (tblPcr == null) {
                                         throw new ASException(ErrorCode.WS_PCR_WHITELIST_DOES_NOT_EXIST, pcrData.getPcrName());
                                    }
                                    // Now update the pcr in the database.
                                    tblPcr.setValue(pcrData.getPcrDigest());
                                    pcrManifestJpaController.edit(tblPcr);

                                } catch (ASException ase) {
                                    throw ase;
                                } catch (Exception e) {
                                    throw new ASException(e);
                                }
                                return "true";
  }
View Full Code Here

Examples of com.intel.mountwilson.as.common.ASException

                                TblPcrManifest tblPcr;
                                TblMle tblMle;
                                try {
                                  tblMle = getMleDetails(mleName, mleVersion, osName, osVersion,oemName);
                                  if (tblMle == null && oemName != null) {
                                        throw new ASException(ErrorCode.WS_MLE_OEM_DOES_NOT_EXIST, mleName, mleVersion, oemName);
                                    }
                                    if (tblMle == null && osName != null) {
                                        throw new ASException(ErrorCode.WS_MLE_OS_DOES_NOT_EXIST, mleName, mleVersion, osName, osVersion);
                                    }
                                   
                                    // Now we need to check if PCR value exists. If it does, then we do delete or else
                                    // we still return true since the data does not exist.
                                    tblPcr = getPCRWhiteListDetails(tblMle.getId(), pcrName);
                                    if (tblPcr == null) {
                                      return "true";
                                    }

                                    // Delete the PCR white list entry.
                                    pcrManifestJpaController.destroy(tblPcr.getId());

                                } catch (ASException ase) {
                                        throw ase;
                                } catch (Exception e) {
                                    throw new ASException(e);
                                }               
                                return "true";
  }
View Full Code Here

Examples of com.intel.mountwilson.as.common.ASException

                                        mleData = mleSourceObj.getMleData();
                                        // Verify if the MLE exists in the system.
                                        tblMle = getMleDetails(mleData.getName(), mleData.getVersion(), mleData.getOsName(),
                                                        mleData.getOsVersion(), mleData.getOemName());
                                    } catch (NoResultException nre){
                                        throw new ASException(nre,ErrorCode.WS_MLE_DOES_NOT_EXIST, mleData.getName(), mleData.getVersion());
                                    }

                                    MwMleSourceJpaController mleSourceJpaController = new MwMleSourceJpaController(getEntityManagerFactory());

                                    // Let us check if there is a mapping entry already for this MLE. If it does, then we need to return
                                    // back appropriate error.
                                    MwMleSource mleSourceCurrentObj = mleSourceJpaController.findByMleId(tblMle.getId());

                                    if (mleSourceCurrentObj != null) {
                                        log.error("White List host is already mapped to the MLE - " + tblMle.getName());
                                        throw new ASException(ErrorCode.WS_MLE_SOURCE_MAPPING_ALREADY_EXISTS, mleData.getName());
                                    }

                                    // Else create a new entry in the DB.
                                    MwMleSource mleSourceData = new MwMleSource();
                                    mleSourceData.setMleId(tblMle);
                                    mleSourceData.setHostName(mleSourceObj.getHostName());       

                                    mleSourceJpaController.create(mleSourceData);

                                } catch (ASException ase) {
                                        throw ase;
                                } catch (Exception e) {
                                    throw new ASException(e);
                                }                               
                                return "true";
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.