class SystemApiController implements SystemApi {

    @Override
    @PreAuthorize("hasAuthority('UPLOAD_ANCHOR')")
    @AuditEventMethod(event = UPLOAD_ANCHOR)
    public ResponseEntity<Void> replaceAnchor(Resource anchorResource) {
        byte[] anchorBytes = ResourceUtils.springResourceToBytesOrThrowBadRequest(anchorResource);
        try {
            systemService.replaceAnchor(anchorBytes);
        } catch (SystemService.InvalidAnchorInstanceException | SystemService.MalformedAnchorException e) {
            throw new BadRequestException(e);
        } catch (SystemService.AnchorUploadException | ConfigurationDownloadException
                | ConfigurationVerifier.ConfigurationVerificationException e) {
            throw new InternalServerErrorException(e);
        }
        return ApiUtil.createCreatedResponse("/api/system/anchor", null);
    }

    @Autowired public  SystemApiController(InternalTlsCertificateService internalTlsCertificateService,
            CertificateDetailsConverter certificateDetailsConverter, SystemService systemService,
            TimestampingServiceConverter timestampingServiceConverter, AnchorConverter anchorConverter,
            VersionService versionService, VersionConverter versionConverter, CsrFilenameCreator csrFilenameCreator,
            AuditDataHelper auditDataHelper);

}