From bb84e64be801ec921206a70e4de7a165b3c65e94 Mon Sep 17 00:00:00 2001
From: gmantele <gmantele@ari.uni-heidelberg.de>
Date: Wed, 10 Dec 2014 18:32:30 +0100
Subject: [PATCH] [TAP] Forbid query execution also in asynchronous mode IF the
 service is declared as not available.

---
 src/tap/resource/ASync.java | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/src/tap/resource/ASync.java b/src/tap/resource/ASync.java
index 5fe3c9c..fd0e7cd 100644
--- a/src/tap/resource/ASync.java
+++ b/src/tap/resource/ASync.java
@@ -71,7 +71,7 @@ import uws.service.log.UWSLog.LogLevel;
  * </ul>
  * 
  * @author Gr&eacute;gory Mantelet (CDS;ARI)
- * @version 2.0 (09/2014)
+ * @version 2.0 (12/2014)
  * 
  * @see UWSService
  */
@@ -181,7 +181,14 @@ public class ASync implements TAPResource {
 	@Override
 	public boolean executeResource(final HttpServletRequest request, final HttpServletResponse response) throws IOException, TAPException{
 		try{
+
+			// Ensure the service is currently available:
+			if (!service.isAvailable())
+				throw new TAPException("Can not execute a query: this TAP service is not available! " + service.getAvailability(), UWSException.SERVICE_UNAVAILABLE);
+
+			// Forward the request to the UWS service:
 			return uws.executeRequest(request, response);
+
 		}catch(UWSException ue){
 			throw new TAPException(ue);
 		}
-- 
GitLab