changeset 147:925274a4ba55

Expose swagger spec for jvm-gc/jvm-memory services. API docs entry point is (renders commands API currently): http://127.0.0.1:30000/doc/ API docs for jvm-gc service can be viewed via: http://127.0.0.1:30000/doc/index.html?url=http://127.0.0.1:30000/jvm-gc/0.0.2/doc/jvm-gc-swagger.yaml API docs for jvm-memory service can be viewed via: http://127.0.0.1:30000/doc/index.html?url=http://127.0.0.1:30000/jvm-memory/0.0.2/doc/jvm-memory-swagger.yaml Reviewed-by: jkang Review-thread: http://icedtea.classpath.org/pipermail/thermostat/2017-May/023090.html
author Severin Gehwolf <sgehwolf@redhat.com>
date Mon, 15 May 2017 17:19:26 +0200
parents 7e1c6071024c
children d78d32242c62
files common/core/pom.xml common/core/src/main/java/com/redhat/thermostat/gateway/common/core/servlet/BasicResourceHandler.java server/src/main/resources/swagger-ui/index.html services/commands/pom.xml services/commands/src/main/java/com/redhat/thermostat/service/commands/http/handlers/BasicResourceHandler.java services/commands/src/main/java/com/redhat/thermostat/service/commands/http/handlers/HtmlResourceHandler.java services/commands/src/main/java/com/redhat/thermostat/service/commands/http/handlers/SwaggerSpecResourceHandler.java services/commands/src/main/resources/commands-swagger.json services/commands/src/main/resources/commands-swagger.yaml services/commands/src/main/webapp/WEB-INF/web.xml services/jvm-gc/jvm-gc-swagger.yaml services/jvm-gc/src/main/java/com/redhat/thermostat/service/jvm/gc/SwaggerSpecResourceHandler.java services/jvm-gc/src/main/resources/jvm-gc-swagger.yaml services/jvm-memory/jvm-memory-swagger.yaml services/jvm-memory/pom.xml services/jvm-memory/src/main/java/com/redhat/thermostat/service/jvm/memory/SwaggerSpecResourceHandler.java services/jvm-memory/src/main/resources/jvm-memory-swagger.yaml
diffstat 17 files changed, 648 insertions(+), 579 deletions(-) [+]
line wrap: on
line diff
--- a/common/core/pom.xml	Wed May 10 11:43:27 2017 -0400
+++ b/common/core/pom.xml	Mon May 15 17:19:26 2017 +0200
@@ -58,8 +58,15 @@
             <artifactId>javax.servlet-api</artifactId>
             <version>${javax.servlet.version}</version>
             <scope>provided</scope>
-    	</dependency>
-        
+        </dependency>
+
+        <!-- JAX-RS Dependencies -->
+        <dependency>
+            <groupId>javax.ws.rs</groupId>
+            <artifactId>javax.ws.rs-api</artifactId>
+            <version>${javax-rs-api.version}</version>
+        </dependency>
+
         <!-- test scoped deps -->
         <dependency>
             <groupId>junit</groupId>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/core/src/main/java/com/redhat/thermostat/gateway/common/core/servlet/BasicResourceHandler.java	Mon May 15 17:19:26 2017 +0200
@@ -0,0 +1,72 @@
+/*
+ * Copyright 2012-2017 Red Hat, Inc.
+ *
+ * This file is part of Thermostat.
+ *
+ * Thermostat is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published
+ * by the Free Software Foundation; either version 2, or (at your
+ * option) any later version.
+ *
+ * Thermostat is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Thermostat; see the file COPYING.  If not see
+ * <http://www.gnu.org/licenses/>.
+ *
+ * Linking this code with other modules is making a combined work
+ * based on this code.  Thus, the terms and conditions of the GNU
+ * General Public License cover the whole combination.
+ *
+ * As a special exception, the copyright holders of this code give
+ * you permission to link this code with independent modules to
+ * produce an executable, regardless of the license terms of these
+ * independent modules, and to copy and distribute the resulting
+ * executable under terms of your choice, provided that you also
+ * meet, for each linked independent module, the terms and conditions
+ * of the license of that module.  An independent module is a module
+ * which is not derived from or based on this code.  If you modify
+ * this code, you may extend this exception to your version of the
+ * library, but you are not obligated to do so.  If you do not wish
+ * to do so, delete this exception statement from your version.
+ */
+
+package com.redhat.thermostat.gateway.common.core.servlet;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.nio.charset.StandardCharsets;
+
+import javax.ws.rs.core.Response;
+
+/**
+ * Static resources handler base class.
+ *
+ */
+public class BasicResourceHandler {
+
+    protected Response getFileAsResponse(ClassLoader loader, String fileName) throws IOException {
+        try (InputStream stream = loader.getResourceAsStream(fileName);) {
+            String responseContent = read(stream);
+            return Response.ok(responseContent).build();
+        }
+    }
+
+    private String read(InputStream stream) throws IOException {
+        try (BufferedReader buffer = new BufferedReader(
+                new InputStreamReader(stream, StandardCharsets.UTF_8))) {
+            String line;
+            StringBuffer b = new StringBuffer();
+            while ((line = buffer.readLine()) != null) {
+                b.append(line);
+                b.append("\n");
+            }
+            return b.toString();
+        }
+    }
+}
--- a/server/src/main/resources/swagger-ui/index.html	Wed May 10 11:43:27 2017 -0400
+++ b/server/src/main/resources/swagger-ui/index.html	Mon May 15 17:19:26 2017 +0200
@@ -74,7 +74,7 @@
   // Build a system
   const ui = SwaggerUIBundle({
     // FIXME: This should eventually point to an aggregate of all our APIs	  
-    url: "../commands/v1/static/doc/commands-swagger.json",
+    url: "../commands/v1/static/doc/commands-swagger.yaml",
     dom_id: '#swagger-ui',
     presets: [
       SwaggerUIBundle.presets.apis,
--- a/services/commands/pom.xml	Wed May 10 11:43:27 2017 -0400
+++ b/services/commands/pom.xml	Mon May 15 17:19:26 2017 +0200
@@ -76,13 +76,6 @@
     	<scope>provided</scope>
     </dependency>
 
-    <!-- JAX-RS Dependencies -->
-    <dependency>
-    	<groupId>javax.ws.rs</groupId>
-    	<artifactId>javax.ws.rs-api</artifactId>
-    	<version>2.0.1</version>
-    </dependency>
-    
     <!-- Decoder/encoder deps -->
     <dependency>
         <groupId>com.google.code.gson</groupId>
--- a/services/commands/src/main/java/com/redhat/thermostat/service/commands/http/handlers/BasicResourceHandler.java	Wed May 10 11:43:27 2017 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,73 +0,0 @@
-/*
- * Copyright 2012-2017 Red Hat, Inc.
- *
- * This file is part of Thermostat.
- *
- * Thermostat is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published
- * by the Free Software Foundation; either version 2, or (at your
- * option) any later version.
- *
- * Thermostat is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Thermostat; see the file COPYING.  If not see
- * <http://www.gnu.org/licenses/>.
- *
- * Linking this code with other modules is making a combined work
- * based on this code.  Thus, the terms and conditions of the GNU
- * General Public License cover the whole combination.
- *
- * As a special exception, the copyright holders of this code give
- * you permission to link this code with independent modules to
- * produce an executable, regardless of the license terms of these
- * independent modules, and to copy and distribute the resulting
- * executable under terms of your choice, provided that you also
- * meet, for each linked independent module, the terms and conditions
- * of the license of that module.  An independent module is a module
- * which is not derived from or based on this code.  If you modify
- * this code, you may extend this exception to your version of the
- * library, but you are not obligated to do so.  If you do not wish
- * to do so, delete this exception statement from your version.
- */
-
-package com.redhat.thermostat.service.commands.http.handlers;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.nio.charset.StandardCharsets;
-
-import javax.ws.rs.core.Response;
-
-/**
- * Basic static resources handler.
- *
- */
-class BasicResourceHandler {
-
-    protected Response getFileAsResponse(String fileName) throws IOException {
-        try (InputStream stream = BasicResourceHandler.class.getClassLoader()
-                .getResourceAsStream(fileName);) {
-            String responseContent = read(stream);
-            return Response.ok(responseContent).build();
-        }
-    }
-
-    private String read(InputStream stream) throws IOException {
-        try (BufferedReader buffer = new BufferedReader(
-                new InputStreamReader(stream, StandardCharsets.UTF_8))) {
-            String line;
-            StringBuffer b = new StringBuffer();
-            while ((line = buffer.readLine()) != null) {
-                b.append(line);
-                b.append("\n");
-            }
-            return b.toString();
-        }
-    }
-}
--- a/services/commands/src/main/java/com/redhat/thermostat/service/commands/http/handlers/HtmlResourceHandler.java	Wed May 10 11:43:27 2017 -0400
+++ b/services/commands/src/main/java/com/redhat/thermostat/service/commands/http/handlers/HtmlResourceHandler.java	Mon May 15 17:19:26 2017 +0200
@@ -45,13 +45,15 @@
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.Response;
 
+import com.redhat.thermostat.gateway.common.core.servlet.BasicResourceHandler;
+
 @Path("{fileName: .+\\.html}")
 @Produces(MediaType.TEXT_HTML)
 public class HtmlResourceHandler extends BasicResourceHandler {
 
     @GET
     public Response getPage(@PathParam("fileName") String fileName) throws IOException {
-        return getFileAsResponse(fileName);
+        return getFileAsResponse(HtmlResourceHandler.class.getClassLoader(), fileName);
     }
 
 }
--- a/services/commands/src/main/java/com/redhat/thermostat/service/commands/http/handlers/SwaggerSpecResourceHandler.java	Wed May 10 11:43:27 2017 -0400
+++ b/services/commands/src/main/java/com/redhat/thermostat/service/commands/http/handlers/SwaggerSpecResourceHandler.java	Mon May 15 17:19:26 2017 +0200
@@ -45,12 +45,14 @@
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.Response;
 
-@Path("doc/{fileName: .+\\.json}")
+import com.redhat.thermostat.gateway.common.core.servlet.BasicResourceHandler;
+
+@Path("doc/{fileName: .+\\.yaml}")
 @Produces(MediaType.TEXT_PLAIN)
 public class SwaggerSpecResourceHandler extends BasicResourceHandler {
 
     @GET
     public Response getFileAsPlainText(@PathParam("fileName") String fileName) throws IOException {
-        return getFileAsResponse(fileName);
+        return getFileAsResponse(SwaggerSpecResourceHandler.class.getClassLoader(), fileName);
     }
 }
--- a/services/commands/src/main/resources/commands-swagger.json	Wed May 10 11:43:27 2017 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,197 +0,0 @@
-{
-  "swagger": "2.0",
-  "info": {
-    "title": "Thermostat Commands API",
-    "description": "Command channel API via Web Sockets",
-    "version": "1.0.0"
-  },
-  "host": "127.0.0.1:30000",
-  "schemes": [
-    "ws",
-    "wss"
-  ],
-  "basePath": "/commands",
-  "produces": [
-    "application/json"
-  ],
-  "consumes": [
-    "application/json"
-  ],
-  "tags": [
-    {
-      "name": "receivers",
-      "description": "Everything for receivers (a.k.a. agents)"
-    },
-    {
-      "name": "clients",
-      "description": "Everything for initiators (a.k.a. clients)"
-    }
-  ],
-  "paths": {
-    "/v1/systems/{systemId}/agents/{agentId}": {
-      "parameters": [
-        {
-          "name": "systemId",
-          "in": "path",
-          "required": true,
-          "type": "string",
-          "description": "The system ID this receiver runs on."
-        },
-        {
-          "name": "agentId",
-          "in": "path",
-          "required": true,
-          "type": "string",
-          "description": "The ID under which to register this receiver."
-        }
-      ],
-      "get": {
-        "tags": [
-          "receivers"
-        ],
-        "summary": "Endpoint for receivers",
-        "description": "Registers a new receiver (a.k.a agent) with the given ID.",
-        "responses": {
-          "200": {
-            "description": "When the upgrade request succeeded and registration for the given ID was successful",
-            "schema": {
-              "$ref": "#/definitions/AgentRequest"
-            }
-          },
-          "401": {
-            "description": "When the request did not provide authentication credentials."
-          },
-          "403": {
-            "description": "When the user posting the request has insufficient privileges to register a receiver for the provided systemId/agentId pairs."
-          }
-        }
-      }
-    },
-    "/v1/actions/{action}/systems/{systemId}/agents/{agentId}/jvms/{jvmId}/sequence/{seqId}": {
-      "parameters": [
-        {
-          "name": "action",
-          "in": "path",
-          "type": "string",
-          "required": true,
-          "description": "The action to perform."
-        },
-        {
-          "name": "systemId",
-          "in": "path",
-          "required": true,
-          "type": "string",
-          "description": "The system ID this receiver runs on."
-        },
-        {
-          "name": "jvmId",
-          "in": "path",
-          "required": true,
-          "type": "string",
-          "description": "The JVM ID to perform an action on."
-        },
-        {
-          "name": "agentId",
-          "in": "path",
-          "required": true,
-          "type": "string",
-          "description": "The ID under which to register this receiver."
-        },
-        {
-          "name": "seqId",
-          "in": "path",
-          "required": true,
-          "type": "integer",
-          "format": "int64",
-          "description": "The sequence ID to use for this conversation. Matching responses will have the same sequence ID as provided via seqId."
-        }
-      ],
-      "get": {
-        "tags": [
-          "clients"
-        ],
-        "summary": "Endpoint for initiators (clients)",
-        "description": "Sends a message to the provided receiver identified via *agentId*",
-        "responses": {
-          "200": {
-            "description": "When the upgrade request succeeded and the message was correctly transmitted to the intended receiver.",
-            "schema": {
-              "$ref": "#/definitions/AgentResponse"
-            }
-          },
-          "401": {
-            "description": "When the request did not provide authentication credentials."
-          },
-          "403": {
-            "description": "When the user posting the request has insufficient privileges to perform the given action for the given receiver, system and JVM."
-          }
-        },
-        "parameters": [
-          {
-            "name": "body",
-            "in": "body",
-            "required": true,
-            "schema": {
-              "properties": {
-                "type": {
-                  "type": "integer",
-                  "description": "The message type's integer representation. 2 for ClientRequest."
-                },
-                "payload": {
-                  "type": "object",
-                  "description": "Arbitrary key-value-pairs of type string representing request parameters."
-                }
-              }
-            }
-          }
-        ]
-      }
-    }
-  },
-  "definitions": {
-    "AgentResponse": {
-      "description": "Response message received from the receiver (agent) via the gateway.",
-      "type": "object",
-      "properties": {
-        "type": {
-          "description": "The message type's integer representation. 100 for AgentResponse.",
-          "type": "integer"
-        },
-        "sequence": {
-          "type": "integer",
-          "format": "int64",
-          "description": "The sequence ID of the initiating request"
-        },
-        "payload": {
-          "type": "object",
-          "description": "The receivers response",
-          "properties": {
-            "respType": {
-              "type": "string",
-              "description": "One of \"OK\", \"ERROR\" or \"AUTH_FAIL\""
-            }
-          }
-        }
-      }
-    },
-    "AgentRequest": {
-      "description": "A relayed client request message sent to the receiver from the gateway on behalf of the client.",
-      "type": "object",
-      "properties": {
-        "type": {
-          "type": "integer",
-          "description": "The message type's integer representation. 1 for AgentRequest."
-        },
-        "sequence": {
-          "type": "integer",
-          "format": "int64",
-          "description": "The sequence ID of the initiating request"
-        },
-        "payload": {
-          "type": "object",
-          "description": "Arbitrary key-value-pairs of type string representing request parameters."
-        }
-      }
-    }
-  }
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/services/commands/src/main/resources/commands-swagger.yaml	Mon May 15 17:19:26 2017 +0200
@@ -0,0 +1,151 @@
+swagger: '2.0'
+info:
+  title: Thermostat Commands API
+  description: Command channel API via Web Sockets
+  version: 1.0.0
+host: '127.0.0.1:30000'
+schemes:
+  - ws
+  - wss
+basePath: /commands
+produces:
+  - application/json
+consumes:
+  - application/json
+tags:
+  - name: receivers
+    description: Everything for receivers (a.k.a. agents)
+  - name: clients
+    description: Everything for initiators (a.k.a. clients)
+paths:
+  '/v1/systems/{systemId}/agents/{agentId}':
+    parameters:
+      - name: systemId
+        in: path
+        required: true
+        type: string
+        description: The system ID this receiver runs on.
+      - name: agentId
+        in: path
+        required: true
+        type: string
+        description: The ID under which to register this receiver.
+    get:
+      tags:
+        - receivers
+      summary: Endpoint for receivers
+      description: Registers a new receiver (a.k.a agent) with the given ID.
+      responses:
+        '200':
+          description: >-
+            When the upgrade request succeeded and registration for the given ID
+            was successful
+          schema:
+            $ref: '#/definitions/AgentRequest'
+        '401':
+          description: When the request did not provide authentication credentials.
+        '403':
+          description: >-
+            When the user posting the request has insufficient privileges to
+            register a receiver for the provided systemId/agentId pairs.
+  '/v1/actions/{action}/systems/{systemId}/agents/{agentId}/jvms/{jvmId}/sequence/{seqId}':
+    parameters:
+      - name: action
+        in: path
+        type: string
+        required: true
+        description: The action to perform.
+      - name: systemId
+        in: path
+        required: true
+        type: string
+        description: The system ID this receiver runs on.
+      - name: jvmId
+        in: path
+        required: true
+        type: string
+        description: The JVM ID to perform an action on.
+      - name: agentId
+        in: path
+        required: true
+        type: string
+        description: The ID under which to register this receiver.
+      - name: seqId
+        in: path
+        required: true
+        type: integer
+        format: int64
+        description: >-
+          The sequence ID to use for this conversation. Matching responses will
+          have the same sequence ID as provided via seqId.
+    get:
+      tags:
+        - clients
+      summary: Endpoint for initiators (clients)
+      description: Sends a message to the provided receiver identified via *agentId*
+      responses:
+        '200':
+          description: >-
+            When the upgrade request succeeded and the message was correctly
+            transmitted to the intended receiver.
+          schema:
+            $ref: '#/definitions/AgentResponse'
+        '401':
+          description: When the request did not provide authentication credentials.
+        '403':
+          description: >-
+            When the user posting the request has insufficient privileges to
+            perform the given action for the given receiver, system and JVM.
+      parameters:
+        - name: body
+          in: body
+          required: true
+          schema:
+            properties:
+              type:
+                type: integer
+                description: >-
+                  The message type's integer representation. 2 for
+                  ClientRequest.
+              payload:
+                type: object
+                description: >-
+                  Arbitrary key-value-pairs of type string representing request
+                  parameters.
+definitions:
+  AgentResponse:
+    description: Response message received from the receiver (agent) via the gateway.
+    type: object
+    properties:
+      type:
+        description: The message type's integer representation. 100 for AgentResponse.
+        type: integer
+      sequence:
+        type: integer
+        format: int64
+        description: The sequence ID of the initiating request
+      payload:
+        type: object
+        description: The receivers response
+        properties:
+          respType:
+            type: string
+            description: 'One of "OK", "ERROR" or "AUTH_FAIL"'
+  AgentRequest:
+    description: >-
+      A relayed client request message sent to the receiver from the gateway on
+      behalf of the client.
+    type: object
+    properties:
+      type:
+        type: integer
+        description: The message type's integer representation. 1 for AgentRequest.
+      sequence:
+        type: integer
+        format: int64
+        description: The sequence ID of the initiating request
+      payload:
+        type: object
+        description: >-
+          Arbitrary key-value-pairs of type string representing request
+          parameters.
--- a/services/commands/src/main/webapp/WEB-INF/web.xml	Wed May 10 11:43:27 2017 -0400
+++ b/services/commands/src/main/webapp/WEB-INF/web.xml	Mon May 15 17:19:26 2017 +0200
@@ -72,8 +72,8 @@
     <!-- Allow viewing of API json spec without authentication -->
     <security-constraint>
       <web-resource-collection>
-        <web-resource-name>Swagger API SPEC JSON File</web-resource-name>
-        <url-pattern>/v1/static/doc/commands-swagger.json</url-pattern>
+        <web-resource-name>Swagger API SPEC YAML File</web-resource-name>
+        <url-pattern>/v1/static/doc/commands-swagger.yaml</url-pattern>
       </web-resource-collection>
       <!-- Explicitly no auth constraint for this file -->
     </security-constraint>
--- a/services/jvm-gc/jvm-gc-swagger.yaml	Wed May 10 11:43:27 2017 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,123 +0,0 @@
-swagger: '2.0'
-info:
-  version: 0.0.2
-  title: Thermostat Web Gateway JVM GC API
-  license:
-    name: GPL v2 with Classpath Exception
-    url: 'http://www.gnu.org/licenses'
-consumes:
-  - application/json
-produces:
-  - application/json
-  - text/html; charset=utf-8
-basePath: /0.0.2
-paths:
-  /:
-    get:
-      description: Get jvm gc information.
-      parameters:
-        - $ref: '#/parameters/limit'
-        - $ref: '#/parameters/offset'
-        - $ref: '#/parameters/sort'
-        - $ref: '#/parameters/projection'
-        - $ref: '#/parameters/query'
-      responses:
-        '200':
-          description: OK
-          schema:
-            $ref: '#/definitions/jvm-gc-stats-response'
-    put:
-      description: Update jvm gc information.
-      parameters:
-        - $ref: '#/parameters/put-body'
-        - $ref: '#/parameters/query'
-      responses:
-        '200':
-          description: OK
-    post:
-      description: Add jvm gc information
-      parameters:
-        - $ref: '#/parameters/jvm-gc-stats'
-      responses:
-        '200':
-          description: OK
-    delete:
-      description: Delete jvm gc information.
-      parameters:
-        - $ref: '#/parameters/query'
-      responses:
-        '200':
-          description: OK
-definitions:
-  jvm-gc-stats-response:
-    type: object
-    properties:
-      response:
-          $ref: '#/definitions/jvm-gc-stats'
-  jvm-gc-stats:
-    type: array
-    items:
-      $ref: '#/definitions/jvm-gc-stat'
-  jvm-gc-stat:
-    type: object
-    properties:
-      agentId:
-        type: string
-      jvmId:
-        type: string
-      timeStamp:
-        type: integer
-        format: int64
-      collectorName:
-        type: string
-      runCount:
-        type: integer
-        format: int64
-      wallTime:
-        type: integer
-        format: int64
-  put-body:
-    type: object
-    properties:
-      "set":
-        type: object
-parameters:
-  jvm-gc-stats:
-    name: jvm-gc-stats
-    in: body
-    description: The jvm gc statistics
-    required: true
-    schema:
-      $ref: '#/definitions/jvm-gc-stats'
-  put-body:
-    name: putBody
-    in: body
-    description: "The JSON object containing a 'set' object. This contains single item JSON objects that specify the field to replace and the JSON value to replace with. Example { \"set\" : { \"field\" : \"value\", \"field2\":{\"object\":\"item\"} }"
-    required: true
-    schema:
-      $ref: '#/definitions/put-body'
-  limit:
-    name: l
-    in: query
-    description: Limit of items to return. Example '1'
-    type: integer
-  offset:
-    name: o
-    in: query
-    description: Offset of items to return. Example '0'
-    type: integer
-  sort:
-    name: s
-    in: query
-    description: Sort string. Comma separated list of fields prefixed with '+' for ascending or '-' for descending. Example '?s=+a,-b' Fields use dot notation for embedded documents. Example 'outer.inner' refers to field inner contained in field outer.
-    type: string
-  query:
-    name: q
-    in: query
-    description: Query string. Comma separated list of key, comparator, value pairs. Comparator supports '==', '<=', '>=', '<', '>', '!='. Example '?q=a==b,c!=d'. Keys are fields in documents and use dot notation for embedded documents. Example 'outer.inner' refers to field inner contained in field outer.
-    type: string
-  projection:
-    name: p
-    in: query
-    description: Projection string. Comma separated list of fields to include in the response. Example '?p=a,b' Fields use dot notation for embedded documents. Example 'outer.inner' refers to field inner contained in field outer.
-    type: string
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/services/jvm-gc/src/main/java/com/redhat/thermostat/service/jvm/gc/SwaggerSpecResourceHandler.java	Mon May 15 17:19:26 2017 +0200
@@ -0,0 +1,59 @@
+/*
+ * Copyright 2012-2017 Red Hat, Inc.
+ *
+ * This file is part of Thermostat.
+ *
+ * Thermostat is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published
+ * by the Free Software Foundation; either version 2, or (at your
+ * option) any later version.
+ *
+ * Thermostat is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Thermostat; see the file COPYING.  If not see
+ * <http://www.gnu.org/licenses/>.
+ *
+ * Linking this code with other modules is making a combined work
+ * based on this code.  Thus, the terms and conditions of the GNU
+ * General Public License cover the whole combination.
+ *
+ * As a special exception, the copyright holders of this code give
+ * you permission to link this code with independent modules to
+ * produce an executable, regardless of the license terms of these
+ * independent modules, and to copy and distribute the resulting
+ * executable under terms of your choice, provided that you also
+ * meet, for each linked independent module, the terms and conditions
+ * of the license of that module.  An independent module is a module
+ * which is not derived from or based on this code.  If you modify
+ * this code, you may extend this exception to your version of the
+ * library, but you are not obligated to do so.  If you do not wish
+ * to do so, delete this exception statement from your version.
+ */
+
+package com.redhat.thermostat.service.jvm.gc;
+
+import java.io.IOException;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+
+import com.redhat.thermostat.gateway.common.core.servlet.BasicResourceHandler;
+
+@Path("doc/{fileName: .+\\.yaml}")
+@Produces(MediaType.TEXT_PLAIN)
+public class SwaggerSpecResourceHandler extends BasicResourceHandler {
+
+    @GET
+    public Response getFileAsPlainText(@PathParam("fileName") String fileName) throws IOException {
+        return getFileAsResponse(SwaggerSpecResourceHandler.class.getClassLoader(), fileName);
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/services/jvm-gc/src/main/resources/jvm-gc-swagger.yaml	Mon May 15 17:19:26 2017 +0200
@@ -0,0 +1,123 @@
+swagger: '2.0'
+info:
+  version: 0.0.2
+  title: Thermostat Web Gateway JVM GC API
+  license:
+    name: GPL v2 with Classpath Exception
+    url: 'http://www.gnu.org/licenses'
+consumes:
+  - application/json
+produces:
+  - application/json
+  - text/html; charset=utf-8
+basePath: /0.0.2
+paths:
+  /:
+    get:
+      description: Get jvm gc information.
+      parameters:
+        - $ref: '#/parameters/limit'
+        - $ref: '#/parameters/offset'
+        - $ref: '#/parameters/sort'
+        - $ref: '#/parameters/projection'
+        - $ref: '#/parameters/query'
+      responses:
+        '200':
+          description: OK
+          schema:
+            $ref: '#/definitions/jvm-gc-stats-response'
+    put:
+      description: Update jvm gc information.
+      parameters:
+        - $ref: '#/parameters/put-body'
+        - $ref: '#/parameters/query'
+      responses:
+        '200':
+          description: OK
+    post:
+      description: Add jvm gc information
+      parameters:
+        - $ref: '#/parameters/jvm-gc-stats'
+      responses:
+        '200':
+          description: OK
+    delete:
+      description: Delete jvm gc information.
+      parameters:
+        - $ref: '#/parameters/query'
+      responses:
+        '200':
+          description: OK
+definitions:
+  jvm-gc-stats-response:
+    type: object
+    properties:
+      response:
+          $ref: '#/definitions/jvm-gc-stats'
+  jvm-gc-stats:
+    type: array
+    items:
+      $ref: '#/definitions/jvm-gc-stat'
+  jvm-gc-stat:
+    type: object
+    properties:
+      agentId:
+        type: string
+      jvmId:
+        type: string
+      timeStamp:
+        type: integer
+        format: int64
+      collectorName:
+        type: string
+      runCount:
+        type: integer
+        format: int64
+      wallTime:
+        type: integer
+        format: int64
+  put-body:
+    type: object
+    properties:
+      "set":
+        type: object
+parameters:
+  jvm-gc-stats:
+    name: jvm-gc-stats
+    in: body
+    description: The jvm gc statistics
+    required: true
+    schema:
+      $ref: '#/definitions/jvm-gc-stats'
+  put-body:
+    name: putBody
+    in: body
+    description: "The JSON object containing a 'set' object. This contains single item JSON objects that specify the field to replace and the JSON value to replace with. Example { \"set\" : { \"field\" : \"value\", \"field2\":{\"object\":\"item\"} }"
+    required: true
+    schema:
+      $ref: '#/definitions/put-body'
+  limit:
+    name: l
+    in: query
+    description: Limit of items to return. Example '1'
+    type: integer
+  offset:
+    name: o
+    in: query
+    description: Offset of items to return. Example '0'
+    type: integer
+  sort:
+    name: s
+    in: query
+    description: Sort string. Comma separated list of fields prefixed with '+' for ascending or '-' for descending. Example '?s=+a,-b' Fields use dot notation for embedded documents. Example 'outer.inner' refers to field inner contained in field outer.
+    type: string
+  query:
+    name: q
+    in: query
+    description: Query string. Comma separated list of key, comparator, value pairs. Comparator supports '==', '<=', '>=', '<', '>', '!='. Example '?q=a==b,c!=d'. Keys are fields in documents and use dot notation for embedded documents. Example 'outer.inner' refers to field inner contained in field outer.
+    type: string
+  projection:
+    name: p
+    in: query
+    description: Projection string. Comma separated list of fields to include in the response. Example '?p=a,b' Fields use dot notation for embedded documents. Example 'outer.inner' refers to field inner contained in field outer.
+    type: string
\ No newline at end of file
--- a/services/jvm-memory/jvm-memory-swagger.yaml	Wed May 10 11:43:27 2017 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,165 +0,0 @@
-swagger: '2.0'
-info:
-  version: 0.0.2
-  title: Thermostat Web Gateway JVM Memory API
-  license:
-    name: GPL v2 with Classpath Exception
-    url: 'http://www.gnu.org/licenses'
-consumes:
-  - application/json
-produces:
-  - application/json
-  - text/html; charset=utf-8
-basePath: /0.0.2
-paths:
-  /:
-    get:
-      description: Get jvm memory information.
-      parameters:
-        - $ref: '#/parameters/limit'
-        - $ref: '#/parameters/offset'
-        - $ref: '#/parameters/sort'
-        - $ref: '#/parameters/projection'
-        - $ref: '#/parameters/query'
-      responses:
-        '200':
-          description: OK
-          schema:
-            $ref: '#/definitions/jvm-memory-stats-response'
-    put:
-      description: Update jvm memory information.
-      parameters:
-        - $ref: '#/parameters/put-body'
-        - $ref: '#/parameters/query'
-      responses:
-        '200':
-          description: OK
-    post:
-      description: Add jvm memory information
-      parameters:
-        - $ref: '#/parameters/jvm-memory-stats'
-      responses:
-        '200':
-          description: OK
-    delete:
-      description: Delete jvm memory information.
-      parameters:
-        - $ref: '#/parameters/query'
-      responses:
-        '200':
-          description: OK
-definitions:
-  jvm-memory-stats-response:
-    type: object
-    properties:
-      response:
-          $ref: '#/definitions/jvm-memory-stats'
-  jvm-memory-stats:
-    type: array
-    items:
-      $ref: '#/definitions/jvm-memory-stat'
-  jvm-memory-stat:
-    type: object
-    properties:
-      agentId:
-        type: string
-      jvmId:
-        type: string
-      timeStamp:
-        type: integer
-        format: int64
-      metaspaceMaxCapacity:
-        type: integer
-        format: int64
-      metaspaceMinCapacity:
-        type: integer
-        format: int64
-      metaspaceCapacity:
-        type: integer
-        format: int64
-      metaspaceUsed:
-        type: integer
-        format: int64
-      generations:
-        type: array
-        items:
-          $ref: '#/definitions/generations-item'
-  generations-item:
-    type: object
-    properties:
-      capacity:
-        type: integer
-        format: int64
-      collector:
-        type: string
-      maxCapacity:
-        type: integer
-        format: int64
-      name:
-        type: string
-      spaces:
-        type: array
-        items:
-          $ref: '#/definitions/spaces-item'
-  spaces-item:
-    type: object
-    properties:
-      capacity:
-        type: integer
-        format: int64
-      index:
-        type: integer
-      maxCapacity:
-        type: integer
-        format: int64
-      name:
-        type: string
-      used:
-        type: integer
-        format: int64
-
-  put-body:
-    type: object
-    properties:
-      "set":
-        type: object
-parameters:
-  jvm-memory-stats:
-    name: jvm-memory-stats
-    in: body
-    description: The jvm memory statistics
-    required: true
-    schema:
-      $ref: '#/definitions/jvm-memory-stats'
-  put-body:
-    name: putBody
-    in: body
-    description: "The JSON object containing a 'set' object. This contains single item JSON objects that specify the field to replace and the JSON value to replace with. Example { \"set\" : { \"field\" : \"value\", \"field2\":{\"object\":\"item\"} }"
-    required: true
-    schema:
-      $ref: '#/definitions/put-body'
-  limit:
-    name: l
-    in: query
-    description: Limit of items to return. Example '1'
-    type: integer
-  offset:
-    name: o
-    in: query
-    description: Offset of items to return. Example '0'
-    type: integer
-  sort:
-    name: s
-    in: query
-    description: Sort string. Comma separated list of fields prefixed with '+' for ascending or '-' for descending. Example '?s=+a,-b' Fields use dot notation for embedded documents. Example 'outer.inner' refers to field inner contained in field outer.
-    type: string
-  query:
-    name: q
-    in: query
-    description: Query string. Comma separated list of key, comparator, value pairs. Comparator supports '==', '<=', '>=', '<', '>', '!='. Example '?q=a==b,c!=d'. Keys are fields in documents and use dot notation for embedded documents. Example 'outer.inner' refers to field inner contained in field outer.
-    type: string
-  projection:
-    name: p
-    in: query
-    description: Projection string. Comma separated list of fields to include in the response. Example '?p=a,b' Fields use dot notation for embedded documents. Example 'outer.inner' refers to field inner contained in field outer.
-    type: string
\ No newline at end of file
--- a/services/jvm-memory/pom.xml	Wed May 10 11:43:27 2017 -0400
+++ b/services/jvm-memory/pom.xml	Mon May 15 17:19:26 2017 +0200
@@ -93,11 +93,5 @@
       <version>${javax-rs-api.version}</version>
       <scope>provided</scope>
     </dependency>
-    <dependency>
-      <groupId>org.eclipse.jetty</groupId>
-      <artifactId>jetty-servlets</artifactId>
-      <version>${jetty.version}</version>
-      <scope>provided</scope>
-    </dependency>
   </dependencies>
 </project>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/services/jvm-memory/src/main/java/com/redhat/thermostat/service/jvm/memory/SwaggerSpecResourceHandler.java	Mon May 15 17:19:26 2017 +0200
@@ -0,0 +1,59 @@
+/*
+ * Copyright 2012-2017 Red Hat, Inc.
+ *
+ * This file is part of Thermostat.
+ *
+ * Thermostat is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published
+ * by the Free Software Foundation; either version 2, or (at your
+ * option) any later version.
+ *
+ * Thermostat is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Thermostat; see the file COPYING.  If not see
+ * <http://www.gnu.org/licenses/>.
+ *
+ * Linking this code with other modules is making a combined work
+ * based on this code.  Thus, the terms and conditions of the GNU
+ * General Public License cover the whole combination.
+ *
+ * As a special exception, the copyright holders of this code give
+ * you permission to link this code with independent modules to
+ * produce an executable, regardless of the license terms of these
+ * independent modules, and to copy and distribute the resulting
+ * executable under terms of your choice, provided that you also
+ * meet, for each linked independent module, the terms and conditions
+ * of the license of that module.  An independent module is a module
+ * which is not derived from or based on this code.  If you modify
+ * this code, you may extend this exception to your version of the
+ * library, but you are not obligated to do so.  If you do not wish
+ * to do so, delete this exception statement from your version.
+ */
+
+package com.redhat.thermostat.service.jvm.memory;
+
+import java.io.IOException;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+
+import com.redhat.thermostat.gateway.common.core.servlet.BasicResourceHandler;
+
+@Path("doc/{fileName: .+\\.yaml}")
+@Produces(MediaType.TEXT_PLAIN)
+public class SwaggerSpecResourceHandler extends BasicResourceHandler {
+
+    @GET
+    public Response getFileAsPlainText(@PathParam("fileName") String fileName) throws IOException {
+        return getFileAsResponse(SwaggerSpecResourceHandler.class.getClassLoader(), fileName);
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/services/jvm-memory/src/main/resources/jvm-memory-swagger.yaml	Mon May 15 17:19:26 2017 +0200
@@ -0,0 +1,165 @@
+swagger: '2.0'
+info:
+  version: 0.0.2
+  title: Thermostat Web Gateway JVM Memory API
+  license:
+    name: GPL v2 with Classpath Exception
+    url: 'http://www.gnu.org/licenses'
+consumes:
+  - application/json
+produces:
+  - application/json
+  - text/html; charset=utf-8
+basePath: /0.0.2
+paths:
+  /:
+    get:
+      description: Get jvm memory information.
+      parameters:
+        - $ref: '#/parameters/limit'
+        - $ref: '#/parameters/offset'
+        - $ref: '#/parameters/sort'
+        - $ref: '#/parameters/projection'
+        - $ref: '#/parameters/query'
+      responses:
+        '200':
+          description: OK
+          schema:
+            $ref: '#/definitions/jvm-memory-stats-response'
+    put:
+      description: Update jvm memory information.
+      parameters:
+        - $ref: '#/parameters/put-body'
+        - $ref: '#/parameters/query'
+      responses:
+        '200':
+          description: OK
+    post:
+      description: Add jvm memory information
+      parameters:
+        - $ref: '#/parameters/jvm-memory-stats'
+      responses:
+        '200':
+          description: OK
+    delete:
+      description: Delete jvm memory information.
+      parameters:
+        - $ref: '#/parameters/query'
+      responses:
+        '200':
+          description: OK
+definitions:
+  jvm-memory-stats-response:
+    type: object
+    properties:
+      response:
+          $ref: '#/definitions/jvm-memory-stats'
+  jvm-memory-stats:
+    type: array
+    items:
+      $ref: '#/definitions/jvm-memory-stat'
+  jvm-memory-stat:
+    type: object
+    properties:
+      agentId:
+        type: string
+      jvmId:
+        type: string
+      timeStamp:
+        type: integer
+        format: int64
+      metaspaceMaxCapacity:
+        type: integer
+        format: int64
+      metaspaceMinCapacity:
+        type: integer
+        format: int64
+      metaspaceCapacity:
+        type: integer
+        format: int64
+      metaspaceUsed:
+        type: integer
+        format: int64
+      generations:
+        type: array
+        items:
+          $ref: '#/definitions/generations-item'
+  generations-item:
+    type: object
+    properties:
+      capacity:
+        type: integer
+        format: int64
+      collector:
+        type: string
+      maxCapacity:
+        type: integer
+        format: int64
+      name:
+        type: string
+      spaces:
+        type: array
+        items:
+          $ref: '#/definitions/spaces-item'
+  spaces-item:
+    type: object
+    properties:
+      capacity:
+        type: integer
+        format: int64
+      index:
+        type: integer
+      maxCapacity:
+        type: integer
+        format: int64
+      name:
+        type: string
+      used:
+        type: integer
+        format: int64
+
+  put-body:
+    type: object
+    properties:
+      "set":
+        type: object
+parameters:
+  jvm-memory-stats:
+    name: jvm-memory-stats
+    in: body
+    description: The jvm memory statistics
+    required: true
+    schema:
+      $ref: '#/definitions/jvm-memory-stats'
+  put-body:
+    name: putBody
+    in: body
+    description: "The JSON object containing a 'set' object. This contains single item JSON objects that specify the field to replace and the JSON value to replace with. Example { \"set\" : { \"field\" : \"value\", \"field2\":{\"object\":\"item\"} }"
+    required: true
+    schema:
+      $ref: '#/definitions/put-body'
+  limit:
+    name: l
+    in: query
+    description: Limit of items to return. Example '1'
+    type: integer
+  offset:
+    name: o
+    in: query
+    description: Offset of items to return. Example '0'
+    type: integer
+  sort:
+    name: s
+    in: query
+    description: Sort string. Comma separated list of fields prefixed with '+' for ascending or '-' for descending. Example '?s=+a,-b' Fields use dot notation for embedded documents. Example 'outer.inner' refers to field inner contained in field outer.
+    type: string
+  query:
+    name: q
+    in: query
+    description: Query string. Comma separated list of key, comparator, value pairs. Comparator supports '==', '<=', '>=', '<', '>', '!='. Example '?q=a==b,c!=d'. Keys are fields in documents and use dot notation for embedded documents. Example 'outer.inner' refers to field inner contained in field outer.
+    type: string
+  projection:
+    name: p
+    in: query
+    description: Projection string. Comma separated list of fields to include in the response. Example '?p=a,b' Fields use dot notation for embedded documents. Example 'outer.inner' refers to field inner contained in field outer.
+    type: string
\ No newline at end of file