@PathParam("ref") String reference) {
logger.entering(this.getClass().getName(), "retrieveBuildStatus");
HashMap<String, String> buildStatus = new HashMap<String, String>();
BuildStatusManager buildStateManager = BuildStatusManager.getInstance();
// Retrieve current build state for reference build
BuildState buildState = buildStateManager.retrieveBuildState(reference);
// Store resulting state in the response
buildStatus.put("state", buildState.toString());
buildStatus.put("logs", buildStateManager.getCompleteBuildLog(reference));
// If build has completed, include resource link, otherwise just include
// current logs.
if (buildState == BuildState.COMPLETED) {
buildStatus.put("result", layersBuildResourcePath(request, reference));
// Unless build is complete, response contents will likely change so ensure result isn't