Search in sources :

Example 6 with RpkiRepositoryValidationRun

use of net.ripe.rpki.validator3.domain.RpkiRepositoryValidationRun in project rpki-validator-3 by RIPE-NCC.

the class RrdpService method addRpkiObject.

private void addRpkiObject(RpkiRepositoryValidationRun validationRun, String uri, DeltaPublish deltaPublish, final byte[] existingHash) {
    final Either<ValidationResult, RpkiObject> maybeRpkiObject = createRpkiObject(uri, deltaPublish.getContent());
    if (maybeRpkiObject.isLeft()) {
        validationRun.addChecks(maybeRpkiObject.left().value());
    } else {
        RpkiObject object = maybeRpkiObject.right().value();
        if (existingHash == null || !Arrays.equals(object.getSha256(), existingHash)) {
            validationRun.addRpkiObject(object);
            rpkiObjectRepository.add(object);
        } else {
            log.debug("The object added is the same {}", object);
        }
        log.debug("Added to database {}", object);
    }
}
Also used : RpkiObject(net.ripe.rpki.validator3.domain.RpkiObject) ValidationResult(net.ripe.rpki.commons.validation.ValidationResult)

Aggregations

RpkiObject (net.ripe.rpki.validator3.domain.RpkiObject)5 ValidationResult (net.ripe.rpki.commons.validation.ValidationResult)4 ValidationCheck (net.ripe.rpki.validator3.domain.ValidationCheck)4 RpkiRepository (net.ripe.rpki.validator3.domain.RpkiRepository)3 RpkiRepositoryValidationRun (net.ripe.rpki.validator3.domain.RpkiRepositoryValidationRun)3 Either (fj.data.Either)2 ByteArrayInputStream (java.io.ByteArrayInputStream)2 BigInteger (java.math.BigInteger)2 Arrays (java.util.Arrays)2 Comparator (java.util.Comparator)2 List (java.util.List)2 Optional (java.util.Optional)2 Collectors (java.util.stream.Collectors)2 Transactional (javax.transaction.Transactional)2 Slf4j (lombok.extern.slf4j.Slf4j)2 CertificateRepositoryObject (net.ripe.rpki.commons.crypto.CertificateRepositoryObject)2 CertificateRepositoryObjectFactory (net.ripe.rpki.commons.crypto.util.CertificateRepositoryObjectFactory)2 ErrorCodes (net.ripe.rpki.validator3.domain.ErrorCodes)2 RpkiObjects (net.ripe.rpki.validator3.domain.RpkiObjects)2 Hex (net.ripe.rpki.validator3.util.Hex)2