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

@@ -169,11 +169,14 @@ public class BasicRepositoryManager extends AbstractRepositoryManager
for (RepositoryHandler handler : handlerMap.values()) for (RepositoryHandler handler : handlerMap.values())
{ {
repository = handler.get(id); if (handler.isConfigured())
if (repository != null)
{ {
break; repository = handler.get(id);
if (repository != null)
{
break;
}
} }
} }
@@ -193,11 +196,14 @@ public class BasicRepositoryManager extends AbstractRepositoryManager
for (RepositoryHandler handler : handlerMap.values()) for (RepositoryHandler handler : handlerMap.values())
{ {
Collection<Repository> handlerRepositories = handler.getAll(); if (handler.isConfigured())
if (handlerRepositories != null)
{ {
repositories.addAll(handlerRepositories); Collection<Repository> handlerRepositories = handler.getAll();
if (handlerRepositories != null)
{
repositories.addAll(handlerRepositories);
}
} }
} }
@@ -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;
} }