use of com.intel.mtwilson.as.data.TblPcrManifest in project OpenAttestation by OpenAttestation.
the class MleBO method deletePCRWhiteList.
/**
*
* Added By: Sudhir on June 20, 2012
*
* Processes the delete request for an existing PCR white list for the specified MLE.
*
* @param pcrName : Name of the PCR, which is usually the number
* @param mleName : Name of the associated MLE
* @param mleVersion : Version of the associated MLE
* @param osName : OS name associated with the VMM MLE
* @param osVersion : OS version associated with the VMM MLE
* @param oemName : OEM Name associated with the BIOS MLE
* @return
*/
public String deletePCRWhiteList(String pcrName, String mleName, String mleVersion, String osName, String osVersion, String oemName) {
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";
}
use of com.intel.mtwilson.as.data.TblPcrManifest in project OpenAttestation by OpenAttestation.
the class MleBO method updatePCRWhiteList.
/**
* Added By: Sudhir on June 20, 2012
*
* Processes the update request for an existing PCR white list for the specified MLE.
*
* @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());
pcrManifestJpaController.edit(tblPcr);
} catch (ASException ase) {
throw ase;
} catch (Exception e) {
throw new ASException(e);
}
return "true";
}
use of com.intel.mtwilson.as.data.TblPcrManifest in project OpenAttestation by OpenAttestation.
the class MleBOTest method mockFindVmmMle.
public TblMle mockFindVmmMle() {
String vmmName = "XEN";
String vmmVersion = "4.3";
String osName = "Fedora";
String osVersion = "20";
TblMle vmmMle = new TblMle();
vmmMle.setId(MLE_ID2);
vmmMle.setName(vmmName);
vmmMle.setVersion(vmmVersion);
vmmMle.setOemId(new TblOem());
TblOs os = new TblOs();
os.setId(1);
os.setName(osName);
os.setVersion(osVersion);
vmmMle.setOsId(os);
Collection<TblPcrManifest> tblPcrManifestCollectionVMM = new ArrayList<TblPcrManifest>();
TblPcrManifest tblPcrManifestVMM = new TblPcrManifest();
tblPcrManifestVMM.setId(2);
tblPcrManifestVMM.setName("18");
tblPcrManifestVMM.setValue("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF");
tblPcrManifestCollectionVMM.add(tblPcrManifestVMM);
vmmMle.setTblPcrManifestCollection(tblPcrManifestCollectionVMM);
return vmmMle;
}
use of com.intel.mtwilson.as.data.TblPcrManifest in project OpenAttestation by OpenAttestation.
the class MleBOTest method mockFindBiosMle.
public TblMle mockFindBiosMle() {
String biosName = "DELL";
String biosVersion = "A08";
String oemName = "DELL";
TblMle biosMle = new TblMle();
biosMle.setId(MLE_ID1);
biosMle.setName(biosName);
biosMle.setVersion(biosVersion);
TblOem oem = new TblOem();
oem.setId(1);
oem.setName(oemName);
biosMle.setOemId(oem);
biosMle.setOsId(new TblOs());
Collection<TblPcrManifest> tblPcrManifestCollection = new ArrayList<TblPcrManifest>();
TblPcrManifest tblPcrManifest = new TblPcrManifest();
tblPcrManifest.setId(1);
tblPcrManifest.setName("0");
tblPcrManifest.setValue("31B97D97B4679917EC3C1D943635693FFBAB4143");
tblPcrManifestCollection.add(tblPcrManifest);
biosMle.setTblPcrManifestCollection(tblPcrManifestCollection);
return biosMle;
}
use of com.intel.mtwilson.as.data.TblPcrManifest in project OpenAttestation by OpenAttestation.
the class TblMleJpaController method destroy.
public void destroy(Integer id) throws IllegalOrphanException, NonexistentEntityException {
EntityManager em = getEntityManager();
try {
em.getTransaction().begin();
TblMle tblMle;
try {
tblMle = em.getReference(TblMle.class, id);
tblMle.getId();
} catch (EntityNotFoundException enfe) {
throw new NonexistentEntityException("The tblMle with id " + id + " no longer exists.", enfe);
}
List<String> illegalOrphanMessages = null;
Collection<TblHosts> tblHostsCollectionOrphanCheck = tblMle.getTblHostsCollection();
for (TblHosts tblHostsCollectionOrphanCheckTblHosts : tblHostsCollectionOrphanCheck) {
if (illegalOrphanMessages == null) {
illegalOrphanMessages = new ArrayList<String>();
}
illegalOrphanMessages.add("This TblMle (" + tblMle + ") cannot be destroyed since the TblHosts " + tblHostsCollectionOrphanCheckTblHosts + " in its tblHostsCollection field has a non-nullable vmmMleId field.");
}
Collection<TblHosts> tblHostsCollection1OrphanCheck = tblMle.getTblHostsCollection1();
for (TblHosts tblHostsCollection1OrphanCheckTblHosts : tblHostsCollection1OrphanCheck) {
if (illegalOrphanMessages == null) {
illegalOrphanMessages = new ArrayList<String>();
}
illegalOrphanMessages.add("This TblMle (" + tblMle + ") cannot be destroyed since the TblHosts " + tblHostsCollection1OrphanCheckTblHosts + " in its tblHostsCollection1 field has a non-nullable biosMleId field.");
}
Collection<TblPcrManifest> tblPcrManifestCollectionOrphanCheck = tblMle.getTblPcrManifestCollection();
for (TblPcrManifest tblPcrManifestCollectionOrphanCheckTblPcrManifest : tblPcrManifestCollectionOrphanCheck) {
if (illegalOrphanMessages == null) {
illegalOrphanMessages = new ArrayList<String>();
}
illegalOrphanMessages.add("This TblMle (" + tblMle + ") cannot be destroyed since the TblPcrManifest " + tblPcrManifestCollectionOrphanCheckTblPcrManifest + " in its tblPcrManifestCollection field has a non-nullable mleId field.");
}
if (illegalOrphanMessages != null) {
throw new IllegalOrphanException(illegalOrphanMessages);
}
em.remove(tblMle);
em.getTransaction().commit();
} finally {
em.close();
}
}
Aggregations