use of org.apache.archiva.configuration.model.FileType in project archiva by apache.
the class ConfigurationRegistryReader method readFileType.
private FileType readFileType(String prefix, Registry registry) {
FileType value = new FileType();
// String id = registry.getString( prefix + "id", value.getId() );
List<String> idList = registry.getList(prefix + "id");
String id = value.getId();
if (idList != null && !idList.isEmpty()) {
StringBuilder sb = new StringBuilder();
for (int i = 0, size = idList.size(); i < size; i++) {
sb.append(idList.get(i));
if (i < size - 1) {
sb.append(',');
}
}
id = sb.toString();
}
value.setId(id);
java.util.List patterns = new java.util.ArrayList();
patterns.addAll(registry.getList(prefix + "patterns.pattern"));
value.setPatterns(patterns);
return value;
}
use of org.apache.archiva.configuration.model.FileType in project archiva by apache.
the class ConfigurationRegistryReader method readRepositoryScanningConfiguration.
private RepositoryScanningConfiguration readRepositoryScanningConfiguration(String prefix, Registry registry) {
RepositoryScanningConfiguration value = new RepositoryScanningConfiguration();
java.util.List fileTypes = new java.util.ArrayList();
List fileTypesSubsets = registry.getSubsetList(prefix + "fileTypes.fileType");
for (Iterator i = fileTypesSubsets.iterator(); i.hasNext(); ) {
FileType v = readFileType("", (Registry) i.next());
fileTypes.add(v);
}
value.setFileTypes(fileTypes);
java.util.List knownContentConsumers = new java.util.ArrayList();
knownContentConsumers.addAll(registry.getList(prefix + "knownContentConsumers.knownContentConsumer"));
value.setKnownContentConsumers(knownContentConsumers);
java.util.List invalidContentConsumers = new java.util.ArrayList();
invalidContentConsumers.addAll(registry.getList(prefix + "invalidContentConsumers.invalidContentConsumer"));
value.setInvalidContentConsumers(invalidContentConsumers);
return value;
}
use of org.apache.archiva.configuration.model.FileType in project archiva by apache.
the class RepositoryPurgeConsumerTest method cleanupFileTypes.
private void cleanupFileTypes() {
ArchivaConfiguration archivaConfiguration = applicationContext.getBean("archivaConfiguration#default", ArchivaConfiguration.class);
FileType fileType = archivaConfiguration.getConfiguration().getRepositoryScanning().getFileTypes().get(0);
fileType.removePattern("**/*.xml");
}
use of org.apache.archiva.configuration.model.FileType in project archiva by apache.
the class MockConfiguration method initialize.
@PostConstruct
public void initialize() throws Exception {
configuration.setRepositoryScanning(new RepositoryScanningConfiguration() {
@Override
public List<FileType> getFileTypes() {
FileType fileType = new FileType();
fileType.setId(FileTypes.ARTIFACTS);
fileType.setPatterns(Collections.singletonList("**/*"));
return Collections.singletonList(fileType);
}
});
ArchivaRuntimeConfiguration rt = new ArchivaRuntimeConfiguration();
List<String> checksums = new ArrayList<>();
checksums.add("MD5");
checksums.add("SHA1");
checksums.add("SHA256");
rt.setChecksumTypes(checksums);
configuration.setArchivaRuntimeConfiguration(rt);
}
use of org.apache.archiva.configuration.model.FileType in project archiva by apache.
the class FileTypes method initialiseTypeMap.
private void initialiseTypeMap(Configuration configuration) {
defaultTypeMap.clear();
// Store the default file type declaration.
List<FileType> filetypes = configuration.getRepositoryScanning().getFileTypes();
for (FileType filetype : filetypes) {
List<String> patterns = defaultTypeMap.get(filetype.getId());
if (patterns == null) {
patterns = new ArrayList<>(filetype.getPatterns().size());
}
patterns.addAll(filetype.getPatterns());
defaultTypeMap.put(filetype.getId(), patterns);
}
}
Aggregations