All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.buschmais.jqassistant.plugin.m2repo.impl.scanner.MavenRepositoryFileResolver Maven / Gradle / Ivy

Go to download

Plugin for jQAssistant to be able to scan and to analyze a M2 repository.

There is a newer version: 1.12.2
Show newest version
package com.buschmais.jqassistant.plugin.m2repo.impl.scanner;

import com.buschmais.jqassistant.core.scanner.api.ScannerContext;
import com.buschmais.jqassistant.plugin.common.api.model.FileDescriptor;
import com.buschmais.jqassistant.plugin.common.api.scanner.AbstractFileResolver;
import com.buschmais.jqassistant.plugin.maven3.api.model.MavenRepositoryDescriptor;

import com.github.benmanes.caffeine.cache.Cache;
import com.github.benmanes.caffeine.cache.Caffeine;

/**
 * A file resolver strategy for a local maven repository.
 * 

* If a file is given which is part of the local maven repository then this * strategy will lookup an existing artifact descriptor. */ public class MavenRepositoryFileResolver extends AbstractFileResolver { private MavenRepositoryDescriptor repositoryDescriptor; private Cache cache = Caffeine.newBuilder().maximumSize(512).build(); /** * Constructor. * * @param repositoryDescriptor The descriptor representing the repository. */ public MavenRepositoryFileResolver(MavenRepositoryDescriptor repositoryDescriptor) { this.repositoryDescriptor = repositoryDescriptor; } @Override public D require(String requiredPath, String containedPath, Class type, ScannerContext context) { return match(requiredPath, type, context); } @Override public D match(String containedPath, Class type, ScannerContext context) { return getOrCreateAs(containedPath, type, path -> repositoryDescriptor.findFile(containedPath), context); } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy