Package com.intel.mtwilson.as.data

Examples of com.intel.mtwilson.as.data.TblMle


  @Override
  public HashMap<String, ? extends IManifest> getBiosGoodKnownManifest(
      String mleName, String mleVersion, String oemName) {
    // Call query method to avoid the objects from the cache
    TblMle biosMle = new TblMleJpaController(getEntityManagerFactory())
        .findBiosMle(mleName, mleVersion, oemName);
    HashMap<String, ? extends IManifest> pcrManifestMap = getPcrManifestMap(biosMle);
    return pcrManifestMap;
  }
View Full Code Here


  @Override
  public HashMap<String, ? extends IManifest> getVmmGoodKnownManifest(
      String mleName, String mleVersion, String osName, String osVersion, Integer hostId) {
    HashMap<String, ? extends IManifest> pcrManifestMap;
    // Call query method to avoid the objects from the cache
    TblMle vmmMle = new TblMleJpaController(getEntityManagerFactory())
        .findVmmMle(mleName, mleVersion, osName, osVersion);

      pcrManifestMap = getPcrManifestMap(vmmMle);

    return pcrManifestMap;
View Full Code Here

   * @param mleData
   * @return
   */
  public String addMLe(MleData mleData) {
                                try {
                                        TblMle tblMle = getMleDetails(mleData.getName(),
                                                        mleData.getVersion(), mleData.getOsName(),
                                                        mleData.getOsVersion(), mleData.getOemName());

                                        if (tblMle != null) {
                                                throw new ASException(ErrorCode.WS_MLE_ALREADY_EXISTS, mleData.getName());
View Full Code Here

         * @param mleData
         * @return
         */
  public String updateMle(MleData mleData) {
                                try {
                                        TblMle tblMle = getMleDetails(mleData.getName(),
                                                        mleData.getVersion(), mleData.getOsName(),
                                                        mleData.getOsVersion(), mleData.getOemName());

                                        if (tblMle == null && mleData.getOemName() != null) {
                                                throw new ASException(ErrorCode.WS_MLE_OEM_DOES_NOT_EXIST, mleData.getName(), mleData.getVersion(), mleData.getOemName());
View Full Code Here

         * @param oemName
         * @return
         */
           public String deleteMle(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);
                                    }

                                    Collection<TblHosts> tblHostsCollection;
                                    if (oemName == null || oemName.isEmpty()) {
                                        tblHostsCollection = tblMle.getTblHostsCollection();
                                    } else {
                                        tblHostsCollection = tblMle.getTblHostsCollection1();
                                    }
                                    if( tblHostsCollection != null ) {
                                        log.info(String.format("MLE '%s' is currently associated with '%d' hosts. ", mleName, tblHostsCollection.size()));

                                        if (!tblHostsCollection.isEmpty()) {
                                            throw new ASException(ErrorCode.WS_MLE_ASSOCIATION_EXISTS, mleName, mleVersion, tblHostsCollection.size());
                                        }
                                    }

                                    for (TblPcrManifest manifest : tblMle.getTblPcrManifestCollection()) {
                                            pcrManifestJpaController.destroy(manifest.getId());
                                    }

                                    // We also need to delete entries in the MleSource table for the MLE. This table would store the host
                                    // name that was used to white list the MLE.
                                    deleteMleSource(mleName, mleVersion, osName, osVersion, oemName);

                                    mleJpaController.destroy(tblMle.getId());

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

         * @param oemName
         * @return
         */
  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);                       
                                        }

View Full Code Here

         * @param osVersion
         * @param oemName
         * @return
         */
  private TblMle getMleDetails(String mleName, String mleVersion,  String osName, String osVersion, String oemName) {
                                TblMle tblMle;
                                log.info(String.format("Mle name '%s' version '%s' os '%s' os version '%s' oem '%s'. ",
                                                mleName, mleVersion, osName, osVersion, oemName));
                                validateNull("mleName", mleName);
                                validateNull("mleVersion", mleVersion);
                                validateMleExtraAttributes(osName, osVersion, oemName);
View Full Code Here

         *
         * @param mleData
         * @return
         */
  private TblMle getTblMle(MleData mleData) {
    TblMle tblMle = new TblMle();

    tblMle.setMLEType(mleData.getMleType());
    tblMle.setName(mleData.getName());
    tblMle.setVersion(mleData.getVersion());
    tblMle.setAttestationType(mleData.getAttestationType());
    tblMle.setDescription(mleData.getDescription());
    tblMle.setRequiredManifestList(getRequiredManifestList(mleData
                .getManifestList()));
    if (mleData.getMleType().equals("VMM")) {
      tblMle.setOsId(getTblOs(mleData.getOsName(), mleData.getOsVersion()));
    } else if (mleData.getMleType().equals("BIOS")) {
      tblMle.setOemId(getTblOem(mleData.getOemName()));
    }

    return tblMle;
  }
View Full Code Here

         *
         * @param pcrData: White list data sent by the user
         * @return : true if the call is successful or else exception.
         */
  public String addPCRWhiteList(PCRWhiteList pcrData) {
                                TblMle tblMle;
                                TblPcrManifest tblPcr;
                                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());
                                   }

           /*
 
View Full Code Here

         *
         * @param pcrData: White list data sent by the user
         * @return : true if the call is successful or else exception.
         */
  public String updatePCRWhiteList(PCRWhiteList pcrData) {
                                TblMle tblMle;
                                TblPcrManifest tblPcr;

                                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());
View Full Code Here

TOP

Related Classes of com.intel.mtwilson.as.data.TblMle

Copyright © 2018 www.massapicom. 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.