use of com.intel.mtwilson.as.helper.ASComponentFactory in project OpenAttestation by OpenAttestation.
the class Host method get.
/**
* Returns the trust status of a host.
*
* Sample request:
* GET http://localhost:8080/AttestationService/resources/hosts/trust?hostName=Some+TXT+Host
*
* Sample output for untrusted host:
* BIOS:0,VMM:0
*
* Sample output for trusted host:
* BIOS:1,VMM:1
*
* @param hostName unique name of the host to query
* @return a string like BIOS:0,VMM:0 representing the trust status
*/
@GET
@Produces({ MediaType.APPLICATION_JSON })
@Path("/trust")
public HostTrustResponse get(@QueryParam("hostName") String hostName) {
try {
// 0.5.1 returned MediaType.TEXT_PLAIN string like "BIOS:0,VMM:0" : return new HostTrustBO().getTrustStatusString(new Hostname(hostName)); // datatype.Hostname
Hostname hostname = new Hostname(hostName);
HostTrustStatus trust = new ASComponentFactory().getHostTrustBO().getTrustStatus(hostname);
return new HostTrustResponse(hostname, trust);
} catch (ASException e) {
throw e;
} catch (Exception e) {
throw new ASException(e);
}
}
Aggregations