use only configured handlers

This commit is contained in:
Sebastian Sdorra
2010-09-15 10:48:57 +02:00
parent fe2af999d2
commit fa395d9b4e

View File

@@ -168,6 +168,8 @@ public class BasicRepositoryManager extends AbstractRepositoryManager
Repository repository = null; Repository repository = null;
for (RepositoryHandler handler : handlerMap.values()) for (RepositoryHandler handler : handlerMap.values())
{
if (handler.isConfigured())
{ {
repository = handler.get(id); repository = handler.get(id);
@@ -176,6 +178,7 @@ public class BasicRepositoryManager extends AbstractRepositoryManager
break; break;
} }
} }
}
return repository; return repository;
} }
@@ -192,6 +195,8 @@ public class BasicRepositoryManager extends AbstractRepositoryManager
Set<Repository> repositories = new HashSet<Repository>(); Set<Repository> repositories = new HashSet<Repository>();
for (RepositoryHandler handler : handlerMap.values()) for (RepositoryHandler handler : handlerMap.values())
{
if (handler.isConfigured())
{ {
Collection<Repository> handlerRepositories = handler.getAll(); Collection<Repository> handlerRepositories = handler.getAll();
@@ -200,6 +205,7 @@ public class BasicRepositoryManager extends AbstractRepositoryManager
repositories.addAll(handlerRepositories); repositories.addAll(handlerRepositories);
} }
} }
}
return repositories; return repositories;
} }
@@ -224,10 +230,11 @@ public class BasicRepositoryManager extends AbstractRepositoryManager
* *
* @return * @return
* *
* @throws RepositoryHandlerNotFoundException *
* @throws RepositoryException
*/ */
private RepositoryHandler getHandler(Repository repository) private RepositoryHandler getHandler(Repository repository)
throws RepositoryHandlerNotFoundException throws RepositoryException
{ {
String type = repository.getType(); String type = repository.getType();
RepositoryHandler handler = handlerMap.get(type); RepositoryHandler handler = handlerMap.get(type);
@@ -237,6 +244,10 @@ public class BasicRepositoryManager extends AbstractRepositoryManager
throw new RepositoryHandlerNotFoundException( throw new RepositoryHandlerNotFoundException(
"could not find handler for ".concat(type)); "could not find handler for ".concat(type));
} }
else if (!handler.isConfigured())
{
throw new RepositoryException("handler is not configured");
}
return handler; return handler;
} }