mirror of
https://github.com/ysoftdevs/nuget-repository-indexer.git
synced 2026-03-18 07:14:25 +01:00
Initial commit
This commit is contained in:
28
src/main/java/com/ysoft/security/Indexer.java
Normal file
28
src/main/java/com/ysoft/security/Indexer.java
Normal file
@@ -0,0 +1,28 @@
|
||||
package com.ysoft.security;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.sql.SQLException;
|
||||
import java.util.Map;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class Indexer {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(Indexer.class);
|
||||
|
||||
private final NugetMetadataStore nugetMetadataStore;
|
||||
|
||||
public Indexer(NugetMetadataStore nugetMetadataStore) {
|
||||
this.nugetMetadataStore = nugetMetadataStore;
|
||||
}
|
||||
|
||||
public void index(InputStream zipIn, String expectedName, String expectedVersion) throws IOException, SQLException {
|
||||
final NugetMetadata nugetMetadata = NugetReader.analyzeNuget(zipIn, expectedName, expectedVersion);
|
||||
for (Map.Entry<String, Map<String, String>> file : nugetMetadata.getHashesForFiles().entrySet()) {
|
||||
nugetMetadataStore.addHash(nugetMetadata.getNugetIdentifier().getId(), nugetMetadata.getNugetIdentifier().getVersion(), file.getKey(),
|
||||
file.getValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user