aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-server
diff options
context:
space:
mode:
authorsimonbrandhof <simon.brandhof@gmail.com>2010-11-02 18:15:15 +0000
committersimonbrandhof <simon.brandhof@gmail.com>2010-11-02 18:15:15 +0000
commit2aa3df37b9c857da35590e048c49ab5c6050b00d (patch)
treea30dd743d0846b73b82a7755c2589d0c07d86f4c /sonar-server
parentd97d0f40e1b7e4390dc6c637e1ae63f3ce533369 (diff)
downloadsonarqube-2aa3df37b9c857da35590e048c49ab5c6050b00d.tar.gz
sonarqube-2aa3df37b9c857da35590e048c49ab5c6050b00d.zip
SONAR-1911 New web service to get server status
Diffstat (limited to 'sonar-server')
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/controllers/api/server_controller.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/api/server_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/api/server_controller.rb
index 65a4dbe41fb..f50ec79f4fa 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/api/server_controller.rb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/api/server_controller.rb
@@ -32,6 +32,7 @@ class Api::ServerController < Api::ApiController
def index
hash={:id => Java::OrgSonarServerPlatform::Platform.getServer().getId(), :version => Java::OrgSonarServerPlatform::Platform.getServer().getVersion()}
+ complete_with_status(hash)
respond_to do |format|
format.json{ render :json => jsonp(hash) }
format.xml { render :xml => hash.to_xml(:skip_types => true, :root => 'server') }
@@ -67,4 +68,15 @@ class Api::ServerController < Api::ApiController
end
hash
end
+
+ def complete_with_status(hash)
+ if DatabaseVersion.uptodate?
+ hash[:status]='UP'
+ elsif ActiveRecord::Base.connected?
+ hash[:status]='SETUP'
+ else
+ hash[:status]='DOWN'
+ hash[:status_msg]='Not connected to database'
+ end
+ end
end