Use maven resolver in Vuln Cache Proc plugin
package eu.fasten.analyzer.vulnerabilitycacheprocessorplugin;
-import eu.fasten.core.data.Constants;
import eu.fasten.core.data.DirectedGraph;
import eu.fasten.core.data.graphdb.RocksDao;
import eu.fasten.core.data.metadatadb.MetadataDao;
import eu.fasten.core.maven.GraphMavenResolver;
+import eu.fasten.core.maven.MavenResolver;
import eu.fasten.core.maven.data.Revision;
import eu.fasten.core.merge.CGMerger;
import eu.fasten.core.plugins.DataWriter;
@@ -67,7 +67,7 @@ public class VulnerabilityCacheProcessorPlugin extends Plugin {
private Exception pluginError = null;
- private static GraphMavenResolver graphResolver;
+ private static MavenResolver mavenResolver;
private static String baseDir;
private static DSLContext dbContext;
@@ -88,13 +88,7 @@ public class VulnerabilityCacheProcessorPlugin extends Plugin {
try {
VulnerabilityCacheProcessorExtension.dbContext = dbContext;
VulnerabilityCacheProcessorExtension.kbDao = new MetadataDao(dbContext);
- var graphResolver = new GraphMavenResolver();
- graphResolver.buildDependencyGraph(dbContext, depGraphPath);
- VulnerabilityCacheProcessorExtension.graphResolver = graphResolver;
- } catch (SQLException e) {
- var err = "Couldn't connect to the Knowledge Base";
- logger.error(err, e);
- this.setPluginError(new SQLException(err, e));
+ VulnerabilityCacheProcessorExtension.mavenResolver = new MavenResolver();
} catch (RuntimeException e) {
var err = "Couldn't connect to the Graph Database";
logger.error(err, e);
@@ -115,13 +109,13 @@ public class VulnerabilityCacheProcessorPlugin extends Plugin {
* @param dbContext - Connection to the database.
* @param kbDao - Knowledge Base Dao.
* @param graphDao - Graph DB Dao.
- * @param graphResolver - Graph Resolver.
+ * @param mavenResolver - Graph Resolver.
*/
- public void loadGraphResolver(DSLContext dbContext, MetadataDao kbDao, RocksDao graphDao, GraphMavenResolver graphResolver) {
+ public void loadGraphResolver(DSLContext dbContext, MetadataDao kbDao, RocksDao graphDao, MavenResolver mavenResolver) {
VulnerabilityCacheProcessorExtension.dbContext = dbContext;
VulnerabilityCacheProcessorExtension.kbDao = kbDao;
VulnerabilityCacheProcessorExtension.graphDao = graphDao;
- VulnerabilityCacheProcessorExtension.graphResolver = graphResolver;
+ VulnerabilityCacheProcessorExtension.mavenResolver = mavenResolver;
}
/**
@@ -272,7 +266,7 @@ public class VulnerabilityCacheProcessorPlugin extends Plugin {
var revision = new Revision(id, groupId, artifactId, version, new Timestamp(timestamp));
logger.info("Processing revision: " + revision.toString());
- var depSet = graphResolver.resolveDependencies(revision, dbContext, true);
+ var depSet = mavenResolver.resolveDependencies(revision.toString());
var depIds = depSet.stream().map(r -> r.id).collect(Collectors.toSet());
logger.info("Dep IDs: " + depIds.size());
