From: James William Dumay Date: Thu, 12 Feb 2009 09:27:47 +0000 (+0000) Subject: Adding repository factory impl X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=5f0610e74ca05226b2963668ce7d492ef8446beb;p=archiva.git Adding repository factory impl git-svn-id: https://svn.apache.org/repos/asf/archiva/branches/archiva-with-new-repoapi@743665 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/archiva-modules/archiva-base/archiva-repository/src/main/java/org/apache/archiva/repository/DefaultRepositoryFactory.java b/archiva-modules/archiva-base/archiva-repository/src/main/java/org/apache/archiva/repository/DefaultRepositoryFactory.java new file mode 100644 index 000000000..0e921297c --- /dev/null +++ b/archiva-modules/archiva-base/archiva-repository/src/main/java/org/apache/archiva/repository/DefaultRepositoryFactory.java @@ -0,0 +1,29 @@ +package org.apache.archiva.repository; + +import java.io.File; +import java.util.HashMap; +import java.util.Map; +import org.apache.archiva.repository.api.Repository; +import org.apache.archiva.repository.api.RepositoryFactory; +import org.apache.maven.archiva.configuration.ArchivaConfiguration; +import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration; + +public class DefaultRepositoryFactory implements RepositoryFactory +{ + private final ArchivaConfiguration archivaConfiguration; + + public DefaultRepositoryFactory(ArchivaConfiguration archivaConfiguration) + { + this.archivaConfiguration = archivaConfiguration; + } + + public Map getRepositories() + { + final HashMap repositories = new HashMap(); + for (ManagedRepositoryConfiguration configuration : archivaConfiguration.getConfiguration().getManagedRepositories()) + { + repositories.put(configuration.getId(), new DefaultRepository(configuration.getId(), configuration.getName(), new File(configuration.getLocation()))); + } + return repositories; + } +}