atc-/docker-registry-web — pull request #89 by marcellodesales (2014-09-23 07:32:47+00:00)
Title: Fixes #80 by capturing the exception if the server is unreachable

This commit fixes the problem by verifying if the search throws an
exception, properly handling it to return an empty list instead.
In addition, the rendering page will display the information about
which Registry URL is unreachable, so that helps admins to properly
handle the problem.

This commit improves the pull request to fix #80 by using a View Wrapper
to the search results when the Registry reaches the server. The new
support class "RegistryReposView" will hold information about the registry,
repositories and if the registry is reachable or not.

The logs will display the following message:

| Error 2014-09-23 00:29:03,155 [http-bio-8080-exec-8] ERROR web.RepositoryService
- The registry http://platform.registry.docker.corp.intuit.net/v1 is unreachable

*	modified: grails-app/views/repository/index.gsp
- Updating the index to use the set of views instead of the Map instance.
- Printing the warning message "(Unreachable) to the header of the repository
in case the server can't be reached.
- Using the alert message documented in the used Theme used by
the application "Journal" at http://bootswatch.com/journal/.

*	new file: src/groovy/docker/registry/web/support/RegistryReposView.groovy
- The new support class that implements the view of the registry, its repositories,
and the status if it is reachable or not.
- Although the service returns a List, this view will always return a Set in order
to avoid any duplicates.
- The factory method "make" returns an instance of the view.

*	modified: grails-app/controllers/docker/registry/web/RepositoryController.groovy
- Importing the wrapper class RegistryReposView
- Preparing the set of repos to be added by the controller

*	modified: grails-app/services/docker/registry/web/RepositoryService.groovy
- Moving the business logic for the view in the service, so that it can be reusable by
other endpoints, controllers and services.