From 5f0610e74ca05226b2963668ce7d492ef8446beb Mon Sep 17 00:00:00 2001 From: James William Dumay Date: Thu, 12 Feb 2009 09:27:47 +0000 Subject: [PATCH] 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 --- .../repository/DefaultRepositoryFactory.java | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 archiva-modules/archiva-base/archiva-repository/src/main/java/org/apache/archiva/repository/DefaultRepositoryFactory.java 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; + } +} -- 2.39.5