.setFilename(handoverInfo.getFilename()) //
.setAction(handoverInfo.getAction()).setParams(handoverInfo.getParams())//
.setContext(contextBuilder.create());
BundleHandoverRequest bundleHandoverRequest = handoverRequestBuilder.createBundleHandoverRequest();
BundleHandoverResponse handoverResponse = bundleManagerProvider.handoverContent(
resourceDeployment.getResource(), bundleHandoverRequest);
boolean success = handoverResponse.isSuccess();
try {
StringWriter attachmentStringWriter = new StringWriter();
PrintWriter attachmentPrintWriter = new PrintWriter(attachmentStringWriter, true);
attachmentPrintWriter.println(bundleHandoverRequest);
if (success) {
bundleManagerProvider.auditDeployment(resourceDeployment, "Handover",
"Successful content handover to bundle target resource", AUDIT_MESSAGE, SUCCESS,
handoverResponse.getMessage(), attachmentStringWriter.toString());
} else {
String handoverFailure = getHandoverFailure(handoverResponse);
Throwable handoverResponseThrowable = handoverResponse.getThrowable();
if (handoverResponseThrowable != null) {
attachmentPrintWriter.println();
attachmentPrintWriter.println(ThrowableUtil.getAllMessages(handoverResponseThrowable));
}
bundleManagerProvider.auditDeployment(resourceDeployment, "Handover", handoverFailure,
AUDIT_MESSAGE, FAILURE, handoverResponse.getMessage(), attachmentStringWriter.toString());
}
} catch (Exception e) {
LOG.warn("Unexpected failure while auditing deployment", e);
}
return success;